Comments (15)
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.
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.
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.
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.
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.
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.
What code are you using?
Original comment by [email protected]
on 29 Jun 2013 at 1:25
from javacv.
[deleted comment]
from javacv.
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.
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.
Is that solved?
Original comment by [email protected]
on 21 Oct 2013 at 1:27
from javacv.
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.
@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.
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.
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)
- FFmpegFrameGrabber won't grab till the end of video. HOT 12
- Conversion of audio in FFMpegFrameGrabber HOT 6
- Cached value of CvMat.fullSize and *Buffer fields might get incorrect HOT 85
- Missing default metadata in FFmpegRecorder HOT 4
- .so files gets deleted on Build&Run (Android) HOT 4
- Execution error HOT 1
- capture problem HOT 4
- Clear documentation on how to use callbacks from FFMpeg and OpenCV in JavaCV using JavaCPP HOT 30
- Memory leaks HOT 2
- Cannot find class file javax.swing.JFrame HOT 1
- FFMpegFrameRecorder is sending an unusually high keyframe rate HOT 4
- IPImage's use of awt classes are causing crashes on some device. HOT 1
- Get duration base on the audio track HOT 9
- EXCEPTION_ACCESS_VIOLATION HOT 2
- cvLoadImage is not work in my android app HOT 15
- Problem using ffmpegframegrabber with a remote camera that needs login HOT 2
- Reconnect problem on Android HOT 1
- Problems with android devices having Android 3.0 or lower version but works well with Android 4.0 and higher version HOT 5
- error: javacv for android on eclipse
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javacv.