• 1

    ..

  • 2

    ...

  • 3

    ...

Showing posts with label image processing. Show all posts
Showing posts with label image processing. Show all posts

Saturday, 13 December 2014

Image resolution Calculation.

Image Resolution: 

        Image  Resolution = (Field of View (FOV) / Number of camera pixels in one direction)  * 2


If the FOV of horizontal direction is 50 mm and the number of sensors in the X direction is 640, the image resolution can be calculated:

                                            = (50 / 640) * 2 = 0.156 mm
                             
                   
If you enjoyed this post plz let us know your views via comments.



This helps us to do much more better.

Thankyou.


Wednesday, 26 June 2013

IMAGE FILE TO TEXT FILE CONVERSION MATLAB – TEXT FILE TO IMAGE FILE CONVERSION MATLAB EXAMPLE



             Here is an example to convert an image into a text file in matlab, for processing in HDL (verilog) or in someother tool. Also the text file is further converted into image file.
           

An image is a 2D matrix. For converting into text file, it needs to be converted into 1D matrix and then to text file using file write in matlab. The image size is also a constraint, so it needs to be fixed for conversion. Then converted to 1D matrix using reshape command. Then write into text file.



A=imread('1.bmp');
B=rgb2gray(A);
disp('Image file read successful');
%figure,imshow(B),title('org');

C=imresize(B,[isize isize]);
figure,imshow(C),title('croped');
d=reshape(C,1,[]);
disp('Reshapping done');
fid = fopen('img.txt', 'wt');
fprintf(fid, '%8d\n', d);
disp('Text file write done');disp(‘ ‘);
fclose(fid);


For converting text file into image, it needs to be converted from 1D matrix and then to image. The image size must same as previous for processing text into image. Then converted to 1D matrix using reshape command. Then write into text file.

·         First, the text file is read using file read  as vector (1D matrix).
·         Then it has to be converted to matrix.
·         Finally transpose to complete it as image.

fidh = fopen('img.txt');
Ah = fscanf(fidh, '%g %g', [1 inf]);
disp('Text file read done');
fclose(fidh);
S1h= vec2mat(Ah,isize,isize);
disp('Vector conversion done');
        %c=imresize(S1,[128 128]);
Sh= transpose(S1h);
Jh=uint8(Sh);
disp('Image is ready');
imwrite(Jh,['newimage','.jpg']);
figure,imshow(Jh),title('IMAGE form TEXT file');


OUTPUT:






If you have any queries mail us to admin@elecdude.com
Viewers comments are encouraged.
It helps us to do better.

Thank you.

Search Here...