Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

converting image into matrix and vice versa?

Tags:

opencv

c#-4.0

Please tell me how to convert image into matrix of pixels and vice versa...using opencv??

like image 340
ranzan Avatar asked Nov 21 '09 10:11

ranzan


People also ask

How do you turn a picture into a matrix?

Convert Image To Matrix in PythonImport Image module from PILLOW library of Python as PIL. Import array module from NUMPY library of Python. These two libraries are for Image extraction from the source file and defining the dimensions of the matrix.

How do you represent an image in a matrix form in Matlab?

To display a matrix as a scaled indexed image, use the MATLAB image display function imagesc . For example, let's display a small magic square using image and then compare it with a display using imagesc . Magic square displayed using image with grayscale colormap.

How do you convert an image to grayscale in Matlab?

I = rgb2gray( RGB ) converts the truecolor image RGB to the grayscale image I . The rgb2gray function converts RGB images to grayscale by eliminating the hue and saturation information while retaining the luminance.


1 Answers

You can treat a matrix or an image as a matrix(or an image) by calling cvGetMat (or cvGetImage).No data will be copied.
If you want to copy the data, use cvCopy.

like image 79
OwnWaterloo Avatar answered Oct 19 '22 22:10

OwnWaterloo