MiaoRong / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

Color issues with trying to resize a buffered Image (I already searched/read previous posts) #169

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Here is the code I am executing:

public static BufferedImage scaleBufferedImage(BufferedImage input, int width, 
int height)
        {
        IplImage image = IplImage.createFrom(input);
        IplImage resizedImage = IplImage.create(width, height, image.depth(), image.nChannels());
        cvResize(image, resizedImage, CV_INTER_AREA);
        return resizedImage.getBufferedImage();
        }

I've attached the input and output images.

What is the expected output? What do you see instead?

From the images attached, you can see the input image has color, and the output 
is RGB with some sort of weird split down the middle?

What version of the product are you using? On what operating system?

This is on OSX, using Eclipse and the JavaCV binaries: javacc.jar, javacpp.jar, 
javacv-macosx-x86_64.jar, javacv.jar

Please provide any additional information below.

I've been spending some time on this trying to resolve it, playing with 
arguments and such, but I'm unsure how to resolve this... it seems like a 
simple operation, and it represents my entry into using this library full time 
in my image processing in java!

Original issue reported on code.google.com by benny....@gmail.com on 9 Mar 2012 at 5:38

Attachments:

GoogleCodeExporter commented 9 years ago
This looks like a duplicate of issue #163. Please try to use 
IplImage.createTo() instead of IplImage.getBufferedImage(), and that should 
take care of your issue.

Original comment by samuel.a...@gmail.com on 9 Mar 2012 at 7:21