Problem in drawing projection profiles

18 ビュー (過去 30 日間)
Mohammad
Mohammad 2017 年 4 月 28 日
回答済み: Mohammad 2017 年 4 月 29 日
I am trying to draw the projection profiles (horizontal and vertical). I wrote the following code which supposes to work correctly. but the results are not the one that I need. Image1 shows the image that I want to process. Image2 shows the Vertical projection of image1 that produced by the code. Image3 shows the correct projection that I should get.
binaryImage = imread(imgFullFileName);
verticalProfile = sum(binaryImage, 1);
horizontalProfile = sum(binaryImage, 2);
[rows, columns] = size(binaryImage);
vertProjImage = area(1:columns,verticalProfile,'FaceColor','k');
image1:
image2:
image3:
  1 件のコメント
Mohammad
Mohammad 2017 年 4 月 29 日
image1
image2
image3

サインインしてコメントする。

採用された回答

Mohammad
Mohammad 2017 年 4 月 29 日
I think using bar() and barh() will solve the problem:
binaryImage = imread(imgFullFileName);
verticalProfile = sum(binaryImage, 1);
horizontalProfile = sum(binaryImage, 2)
[rows, columns] = size(binaryImage);
horzProjImage = barh(horizontalProfile,1,'facecolor','black');
verProjImage = bar(verticalProfile ,1,'facecolor','black');

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by