JP2 converter

Hi all,
I'm capturing video frame with V4L ( Video 4 linux ) and I want to save it in jp2 format, I'm doing it with jpg format but I didn't find nothing related to jp2.

Could somebody show me the way?!

Thanks.
[]s
OpenJPEG is a j2k library you can use.
FreeImage is a library that can read and write multiple image formats, including jp2.
Last edited on
Athar,
thanks for help, but which one do you recommend me!? because I need performance.
I don't think you got much choice, FreeImage also uses OpenJPEG internally to handle jp2 files.
I don't know if there any other implementations.
I'd recommend FreeImage because it is very easy to use. Never used OpenJPEG directly, so I dunno about that.
ok, thanks, I'll try something with FreeImage.
Hey Athar,
Did you already use this library before?!
because I have a void * and I have to save it, but I don't find in the examples, how to do it.

Please, could you please give me some help?!
actually, I need to convert from YUV420 to RGB, and then save in JPEG or JP2, but the FreeImage do not support YUV, then I convert manually, but now I don't know how to save in JPEG, my source at moment is:


void JPGOutput::process(MyFrame frame, string name) {
	string file = "/home/pc/Desktop/img/";
	file.append(name);
	file.append(".jpeg");

	void *rgb24 = NULL;
	rgb24 = yuv420p_to_rgb24(320, 240, (unsigned char *)frame.getFrame(), (unsigned char *)rgb24);
	int fh;

	if (-1 == (fh = open(file.c_str(), O_CREAT|O_WRONLY|O_TRUNC,0666))) {
		if (ENOENT == errno) {
		}
		fprintf(stderr,"open %s: %s\n","teste.jpg",strerror(errno));
		exit(1);
	}

       // here I don't know how can I save the converted rgb24
}
Topic archived. No new replies allowed.