Git Product home page Git Product logo

Comments (15)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Just try to

IplImage imageBGR = IplImage.create(imageWidth, imageHeight, IPL_DEPTH_8U, 3);
                    cvCvtColor(image,imageBGR,CV_YUV2BGR_NV21);

but video is greenish.

Original comment by [email protected] on 14 Jun 2013 at 12:39

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
cvSetImageROI() won't work on planar images, that's normal. You'll need to 
convert that to RGB beforehand.

How do you create the `image` that you use in 
cvCvtColor(image,imageBGR,CV_YUV2BGR_NV21); ?

Original comment by [email protected] on 16 Jun 2013 at 2:02

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Thanks : ),

this way I'm create the 'image'

IplImage image = IplImage.create(imageWidth, imageHeight*3/2, IPL_DEPTH_8U, 2);

Original comment by [email protected] on 17 Jun 2013 at 2:21

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Just found this solution

http://stackoverflow.com/questions/12644627/android-javacv-create-iplimage-from-
camera-to-use-with-colorhistogram

It's worked!, but this is the best way?

Many thanks!

Original comment by [email protected] on 17 Jun 2013 at 3:14

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Thanks for pointing me back to my answer :) But it was not correct. I've edited 
to the following "best way", which should work, but again not tested:
    IplImage imageYUV = IplImage.create(imageWidth, imageHeight * 3 / 2, IPL_DEPTH_8U, 2);
    IplImage imageBGR = IplImage.create(imageWidth, imageHeight, IPL_DEPTH_8U, 3);
    cvCvtColor(imageYUV, imageBGR, CV_YUV2BGR_NV21);
Let me know if you have any problems with that, and please ask your questions 
on the mailing list next time if possible, thanks you!

Original comment by [email protected] on 22 Jun 2013 at 4:15

  • Changed state: Done
  • Added labels: Type-Other
  • Removed labels: Type-Defect

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Thanks!

but it's not work, just greenish like Attach file.

Original comment by [email protected] on 25 Jun 2013 at 3:36

Attachments:

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
What code are you using?

Original comment by [email protected] on 29 Jun 2013 at 1:25

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
[deleted comment]

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
decode yuv420sp to rgb before cropImage and rotateImage..
cvSetImageROI not clearly work on yuv format image..


...
public void onPreviewFrame(byte[] data, Camera camera) {
    ...
    int[] _temp = new int[imageWidth * imageHeight];
    decodeYUV420SP(_temp, data, imageWidth, imageHeight);
    IplImage image = IplImage.create(imageWidth, imageHeight, IPL_DEPTH_8U, 4);
    image.getIntBuffer().put(_temp);
    cvSetImageROI(image, new CvRect(...));
    ...
}

...
public static void decodeYUV420SP(int[] rgb, byte[] yuv420sp, int width, int 
height) {
    int frameSize = width * height;
    for (int j = 0, yp = 0; j < height; j++) {
        int uvp = frameSize + (j >> 1) * width, u = 0, v = 0;
        for (int i = 0; i < width; i++, yp++) {
            int y = (0xff & ((int) yuv420sp[yp])) - 16;
            if (y < 0) y = 0;
            if ((i & 1) == 0) {
                v = (0xff & yuv420sp[uvp++]) - 128;
                u = (0xff & yuv420sp[uvp++]) - 128;
            }
            int y1192 = 1192 * y;
                int r = (y1192 + 1634 * v);
            int g = (y1192 - 833 * v - 400 * u);
            int b = (y1192 + 2066 * u);
            if (r < 0) r = 0; else if (r > 262143) r = 262143;
            if (g < 0) g = 0; else if (g > 262143) g = 262143;
            if (b < 0) b = 0; else if (b > 262143) b = 262143;
            rgb[yp] = 0xff000000 | ((b << 6) & 0xff0000) | ((g >> 2) & 0xff00) | ((r >> 10) & 0xff);
        }
    }
}

Original comment by [email protected] on 29 Jul 2013 at 2:38

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
No it doesn't unfortunately... We need to convert it to RGB first.

Original comment by [email protected] on 15 Aug 2013 at 3:19

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Is that solved?

Original comment by [email protected] on 21 Oct 2013 at 1:27

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Converting it to RGB didn't solve the problem, still green pictures. I'm 
looking for a solution.

Original comment by [email protected] on 21 Oct 2013 at 5:18

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
@omur Can you provide the few lines of code you are using? Thanks

Original comment by [email protected] on 3 Nov 2013 at 1:56

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
hi , 

how did you find the solution for same, 
Can you give me some hint

Thanks

Original comment by [email protected] on 25 Nov 2013 at 9:33

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Guys, if you are having a problem with a piece code, we cannot solve the 
problem if you do not provide the piece of code in question! Please copy/paste 
the piece of code you are executing and that isn't working as it should, thank 
you.

Original comment by [email protected] on 26 Nov 2013 at 6:04

from javacv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.