Cimg and itk image - c++

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.

Related

OPENCV How can I read and use Bayer filter on a NEF image?

I'm currently using opencv C++ to process images that have file type NEF. But imread doesn't seem to work on raw images. Does anyone know how to read and use Bayer filter on a NEF type image? Thanks!
http://www.mannyphoto.com/D700D3/
here are some sample pictures.

Draw dicom raw data in qt

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.

Convert 32bpp image to 8bpp in Leptonica

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

Importing and looping through a PNG image to check for transparency

I would like to write CPP code that is able to take in a PNG file, scan through its pixels and identify where the transparent pixels are.
I tried doing this with CIMG, but it didn't work out as CIMG only supports the RGB channels. Even after installing image magick, the 4th channel is not giving me the right values.
Anyone can suggest a library I could use?

How can I draw a png ontop of another png?

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).