Using hierarchy in findContours () in OpenCV?

The hierarchy returned by findContours has the following form: hierarchy[idx][{0,1,2,3}]={next contour (same level), previous contour (same level), child contour, parent contour} CV_RETR_CCOMP, returns a hierarchy of outer contours and holes. This means elements 2 and 3 of hierarchy[idx] have at most one of these not equal to -1: that is, each element has either no … Read more

Java ImageIO IIOException: Unsupported image type?

Try to check the encoding of the JPEG. ImageIO can’t read CMYK-encoded jpeg images for example. AFAIK, ImageIO hasn’t been updated for years, so you’d like to try and use the official alternative/extension: JAI ImageIO. Unforutnately, JAI ImageIO needs some native libraries installed into the JRE, which might be unwanted. We do the following: use … Read more

How to rotate image with CSS only?

The trouble looks like the image isn’t square and the browser adjusts as such. After rotation ensure the dimensions are retained by changing the image margin. .imagetest img { transform: rotate(270deg); … margin: 10px 0px; } The amount will depend on the difference in height x width of the image. You may also need to … Read more

OpenCV resize fails on large image with “error: (-215) ssize.area() > 0 in function cv::resize”

So it turns out that the problem comes from one line in modules\imgproc\src\imgwarp.cpp: CV_Assert( ssize.area() > 0 ); When the product of rows and columns of the image to be resized is larger than 2^31, ssize.area() results in a negative number. This appears to be a bug in OpenCV and hopefully will be fixed in … Read more

Resizing an image in asp.net without losing the image quality

This is the code I use. It supports rotation, and also sets the image resolution to the JPEG standards of 72dpi@24-bit color (by default GDI+ saves images at 96dpi@32-bit color). It also fixes the black/gray border problem that some people experience when resizing images. /// <summary> /// Resizes and rotates an image, keeping the original … Read more

Smoothing image edges in WPF

You need to set the Image’s render options. Try setting the style of the Image to: <Window.Resources> <Style TargetType=”Image”> <Setter Property=”Height” Value=”64″ /> <Setter Property=”Width” Value=”64″ /> <Setter Property=”RenderOptions.BitmapScalingMode” Value=”HighQuality” /> </Style> </Window.Resources> To use the image, simply call as before: <Image Source=”/Images/MyImage.png” /> Or, to use the RenderOptions on a single image: <Image RenderOptions.BitmapScalingMode=”HighQuality” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)