How to count each pixel with new semantic image
1 次查看(过去 30 天)
显示 更早的评论
I have done the following tutorial: Semantic Segmentation Using Deep Learning » Deep Learning - MATLAB & Simulink (mathworks.com)
I now want to count each pixel for when an image goes through the network and produces semantic data. How do i do this? when the tutorial does count each pixel in the tutorial it does this for one image and uses PXDs.
To perform the semantic segmentation for a random image te following code is used:
I = read(imdsTest);
C = semanticseg(I, net);
B = labeloverlay(I,C,'Colormap',cmap,'Transparency',0.4);
imshow(B)
pixelLabelColorbar(cmap, classes);
How can i use this data to count the pixels in this outputted image for the labels?
The code used at the start to coun each pixel is:
labelDir = fullfile(outputFolder,'labels');
pxds = pixelLabelDatastore(labelDir,classes,labelIDs);
0 个评论
回答(1 个)
Varun Sai Alaparthi
2022-11-15
Hello Benjamin,
I understand that you are looking for a way to get the pixel count with respect to labels for output image but the output from which function wasn’t clearly mentioned.
However, If the output is from the ‘semanticseg’ function following code can be used
c = semanticseg(img,net);
out= reshape (c,1,[]);
Summary(out)
This will provide you the pixel count
Sincerely
Varun
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!