I want to calculate the white area of contour
4 views (last 30 days)
Show older comments

"How can I calculate the white area of this contour?"
In my opinion, the number of white pixels corresponds to the white area I think.
If it is right, could you explain that how to count the number of white pixels.
Or do you have any other idea to calculate the area, please let me know.
thank you.
Here is m-file that creates contour.
clear;
clf;
clc;
filename = 'project.txt';
datatable = load(filename);
data = datatable(2:end,2:end);
length = datatable(1,2:end);
time = datatable(2:end,1).';
datasize=size(data);
row=datasize(1,1);
column=datasize(1,2);
row=1:row;
[c,h]=contourf(length,row',data,[20 2 30]);
colormap gray
grid on
hold on
0 Comments
Answers (1)
Image Analyst
on 23 Jul 2012
I don't have your data file so I can't run your code. But it looks like a gray image with the white being 255 so the usual code for that is
whitePixels = grayImage == 255; % A logical (binary) image
numberOfWhitePixels = sum(whitePixels(:));
5 Comments
Image Analyst
on 24 Jul 2012
You can try export_fig - see the first page of the File Exchange. It's always the top download.
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!