im7 file image processing
23 ビュー (過去 30 日間)
古いコメントを表示
typically scientific cameras are black and white or grey scale and so rather than each pixel having a red, green and blue value to make a color image, only a single value is obtained.
I am working on the code with some image took from the lab.
The files are in *im7 format.
For this image, I am trying to find a enclosed area of the bubble.
For instance area of 1 & 2 of the image.

So I made a code that works on normal jpg files (which is RBG type)
For single image a=imread ('rose.jpg'); % read image
b= rgb2gray (a); %chagne to gray image
c= im2bw(b) % change to binary image
regions1and2 = imclearborder(~c);
area = bwarea(regions1and2);
for multiple images
path= 'F:\Thesis data\'
file= dir([path '*.jpg']);
n_file=length(file); count number of files
x = 1:1:10
for i = 1:n_file
temp = imread([path file(i).name])'
temp2 = rgb2gray (temp)
temp3 = im2bw(temp2)
temp4 = imclearborder(~temp3);
area(i) = bwarea(temp4);
end
plot(1:n_file,area);
xlabel('Time','FontSize',10)
ylabel('area','FontSize',10)
However, as this code is only works with the normal image with RGB info, I found out that I can not use this. I thought of change my image to jpg, but I realiesed this was stupid because this way the image becomes less clear.
Note: what im7 file provide as follow:
readimx is a special code that reads the information of a single im7 file.


So here is a actual question for this issue,
Is there a way to use some of my current code to read im7 file and work out the enclosed area of the image?
0 件のコメント
採用された回答
Image Analyst
2014 年 9 月 4 日
Not sure I understand. You asked this before in this question and I answered it and you accepted. If it's how to get a gray scale image regardless if it's color or grayscale to start with you use this code:
temp = imread([path file(i).name])'
[rows, columns, numberOfColorChannels] = size(temp);
if numberOfColorChannels > 1
temp2 = rgb2gray (temp); % Need to convert RGB to gray
else
temp2 = temp; % It's already gray scale.
end
0 件のコメント
その他の回答 (1 件)
Guillaume
2014 年 9 月 4 日
IType is 0, so this is a plain Davis buffer. It's already a grayscale image, but encoded as uint16 (Davis Word buffer). So you can use your code starting from temp3:
temp3 = im2bw(A.Data);
One potential issue is that your image is not a true 16-bit image (most LaVision cameras are 12-bit), so using the default threshold (32768 counts for uint16) of im2bw is not going to work and your temp3 is going to be all black. If it's a 12-bit image and you want the threshold halfway through the intensity range (2048):
temp3 = im2bw(A.Data, 2048/2^16);
The rest of the code can stay as is.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!