I've recently started working with leptonica Image processing API. But every API function seems to be taking input image of 8bpp and my images are 32bpp (or could be anything else). So is there any function in Leptonica which could convert my image from 32bpp to 8bpp. I've searched but no luck.
Is it so that there is no function to do that or we have to feed leptonica only 8bpp image to process it furthur (Such as binarization)?
Or do we have to convert the image from any other 3rd party tool then feed it to leptonica.
I am new to image processing and leptonica. Thanks in advance for your suggestions.
There are several methods, e.g., pixConvertRGBToGray, pixThresholdToBinary, etc. Check its documentation for usage.
http://tpgit.github.io/UnOfficialLeptDocs/leptonica/
http://tpgit.github.io/UnOfficialLeptDocs/leptonica/functions.html
Related
I'm trying to develop a tool to visualize dicom images
I'm using itk library but i have some problem drawing the data
I'm using gdcm library provided by itk library as a third party lib.
I'm reading the image correctly i retrieved the tags ... but when i retrieve the pixels data using
unsigned short buffer* = ImageFileReader<Image<unsigned short,2>>->GetOutput()->getBufferPointer();
and i put it in QPixmap or QImage i tried both,Qpixelmap when i do loadData i get false as a return value and using QImage, the app crashes !
Any help ? thank you
Look at this example, http://gdcm.sourceforge.net/html/ConvertToQImage_8cxx-example.html
Just use gdcm to read the image and convert it to qimage.
Keep in mind that dicom images are not an image format that qt can draw, you need a conversion step.
I have a Cimg image and I want to use it with ITK (for registration). How can I create a ITK image from this Cimg image. Also can I want to create an OpenCV image from a ITK image? So can I use these libraries together?
Thanks for helping.
The ITK class OpenCVImageBridge will be useful in converting ITK images to OpenCV images:
http://www.itk.org/Doxygen/html/classitk_1_1OpenCVImageBridge.html
Unfortunately I'm not familiar with Cool Image, and so cannot be helpful for the first part of the question. ITK can read a large number of image types--png, dcm, mha, tiff, bmp, etc--your best bet is likely to look down the list of image types that Cimg can write, and find one that ITK can read.
I'm programming an application in c++ with a GUI in GTK3 that will show the images obtained from a genicam camera. I've got the official API of the camera that deals with it and extract returns an unsigned char* to the buffer where the image is contained.
The problem comes when I try to convert the image to a GTK format to render it in the GUI. I've tried with cairo and pixbuf, but I've problems in both of them, as the image is in MONO8 format, and pixbuf only deals with RGB. Cairo can deal with 8bit images, but only if they have an alpha channel, which is not the case.
Does someone know a way to approach this issue?
Thanks in advance
So I have 200k x 200k jpeg and png encoded images. I need to get a segment (say a Rectangle {( 1k, 1k); (2k, 1k)} ) of such encoded image not loading given image info ram entirely. Is such thing possible via OpenCV or there is some other crossplatfom library for such operations?
OpenCV doesn't have an API where you provide a Rect to imread(). I am not aware of any other library that has this feature.
Looking at the source in modules/highgui/src/grfmt_jpeg.cpp, it seems possible to add this feature by subclassing JpegDecoder and providing a bool readData( Mat& img, Point location ) as well as custom version of imread() to call it.
How can I "draw"\"merge" a png top of another png (background) using libpng, while keeping the alpha section of the png being drawn on top of the backhround png. There does not seem to be any tutorials or anything mentioned in the documentation about it.
libpng is a library for loading images stored in the PNG file format. It is not a library for blitting images, compositing images, or anything of that nature. libpng's basic job is to take a file or memory image and turn it into an array of color values. What you're talking about is very much out of scope for libpng.
If you want to do this, you will have to do the image composition yourself manually. Or use a library that can do image composition (cairo, etc).