現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
How to remove frame appear as a result of thresholding
1 回表示 (過去 30 日間)
古いコメントを表示
When I use file exchange https://www.mathworks.com/matlabcentral/fileexchange/12191-bilateral-filtering
it is working well but when I take the result as input to to get threshold the result appear with outerframe as shown in attachment
how can I remove this frame or not allowed it to appear?
回答 (2 件)
Walter Roberson
2023 年 7 月 10 日
Your image has a white border that you need to trim out.
bb1 = imread('bb1.jpg');
imshow(bb1); title('original');
set(gca, 'visible', 'on')
is_all_white = all(bb1 == 255, 3);
vert_profile = ~all(is_all_white, 1);
horz_profile = ~all(is_all_white, 2);
first_col = find(vert_profile, 1);
last_col = find(vert_profile, 1, 'last');
first_row = find(horz_profile, 1);
last_row = find(horz_profile, 1, 'last');
bb1_cropped = bb1(first_row:last_row, first_col:last_col, :);
imshow(bb1_cropped); title('cropped');
set(gca, 'visible', 'on');
4 件のコメント
yasmin ismail
2023 年 7 月 11 日
@Walter Roberson The white board still apear? How can I avoid it from the biginning ? why its appear after using the bilateral filter file exchange? Does it have somthing inside the code that let this board appear? I am matlab bigginer so, I am not familiar with this issue if you can help me please
DGM
2023 年 7 月 30 日
編集済み: DGM
2023 年 7 月 30 日
There's still a white border because the image is a JPG. The edge transitions are not white or uniform, so you have to be more aggressive to cut off as much as the artifacts as you can.
bb1 = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1431283/bb1.jpg');
is_all_white = all(bb1 > 200, 3);
vert_profile = ~all(is_all_white, 1);
horz_profile = ~all(is_all_white, 2);
first_col = find(vert_profile, 1);
last_col = find(vert_profile, 1, 'last');
first_row = find(horz_profile, 1);
last_row = find(horz_profile, 1, 'last');
bb1_cropped = bb1(first_row:last_row, first_col:last_col, :);
imshow(bb1_cropped)
Does the cropped image have any remaining light remnants of the padding? Yes. JPG ruins hard edges. Is the cropped image the same size as the original photo? Very unlikely. It's probably scaled by some unknown amount, because it's a screenshot.
yasmin ismail
2023 年 7 月 30 日
My image is png but have same problem as shown in attach how to fix it please?
Note, i want to use this image as input to another script
DGM
2023 年 7 月 30 日
Note that there are two separate issues. The primary problem is that the image is at some point being padded by capturing a screenshot. The padding will create false edges no matter what image format is used. The use of JPG simply degrades the image further, making it slightly more problematic to crop the result.
Given the inconsistent and nonstandard geometry of both the padded and base images in these samples, that's by far the most likely reason they've appear this way.
If you save an image by displaying it and then taking a screenshot with saveas(), print(), etc, the result will not reliably be the same size as the original, and it will contain an unpredictable amount of white padding. In other words, a screenshot is not a faithful copy of the image stored in memory. Save the image directly using imwrite().
Image Analyst
2023 年 7 月 27 日
Avoid the white frame altogether by using imwrite to save the image, rather than saveas or print or whatever other function you're using.
17 件のコメント
yasmin ismail
2023 年 7 月 30 日
編集済み: yasmin ismail
2023 年 7 月 30 日
@Image Analyst if I use imwrite to save image, how can I use mat format to be as input for other process ?
For example: if I use bilateral filter from file exchange, the output will be saved using imwrite to avoide white fram, then i want to make segmentation using your interactive thresholding app , so how can I call this mat file to applly segmentation by your interactive thresholding app?
Image Analyst
2023 年 7 月 30 日
You can just use the varaible still in memory. You do not HAVE to save it out to a disk file. If you want to save other variables to a .mat file, you can do so with the save() function, though it's not necessary unless you're recalling those variables from a completely different program. Otherwise in your same program. just use the variables by passing them to other functions via the argument list.
Image Analyst
2023 年 7 月 30 日
Like this
rgbImage = imread(filename);
imshow(rgbImage);
% Now process it immediately and directly.
% There is absolutely no need to save rgbImage or
% the figure window (screenshot) to disk before using it again.
outputImage = AnalyzeSingleImage(rgbImage);
% Now do something with this next image, like display it.
% There is absolutely no need to save rgbImage or the figure window (screenshot) to disk before using it again.
imshow(outputImage);
msgbox('done');
% Define some function that does something.
function outputImage = AnalyzeSingleImage(rgbImage)
outputImage = rgbImage - 50;
Notice that nowhere in that code did I use saveas(), print(), imwrite() to save any images to disk. I just used the variables because they were already in memory.
yasmin ismail
2023 年 7 月 31 日
編集済み: Image Analyst
2023 年 7 月 31 日
@Image Analyst I did what you said but I got an error when I used your segmentation app because I did some process before using it and when I used the output from previous process (assume 1) to be input for your segementation app I got an following error. I attached the image result from Process (1)
rgbImage = imread(filename);
imshow(rgbImage);
outputImage = AnalyzeSingleImage(rgbImage);
imshow(outputImage); %Result of process 1
msgbox('done');
% Now your segmentation app
% Get the dimensions of the image.
% numberOfColorChannels should be = 1 for a gray scale image, and 3 for an RGB color image.
[rows, columns, numberOfColorChannels] = size(outputImage)
if numberOfColorChannels > 1
% It's not really gray scale like we expected - it's color.
% Use weighted sum of ALL channels to create a gray scale image.
% grayImage = rgb2gray(outputImage);
% ALTERNATE METHOD: Convert it to gray scale by taking only the green channel,
% which in a typical snapshot will be the least noisy channel.
grayImage = grayImage(:, :, 3); % Take Blue channel.
else
grayImage = grayImage; % It's already gray scale.
end
% Now it's gray scale with range of 0 to 255.
subplot(2, 3, 1);
imshow(outputImage, [])
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
title('Original Image', 'FontSize', fontSize);
% Binarize the image.
% mask = imbinarize(grayImage);
lowThreshold = 0;
highThreshold = 220;
% Interactively and visually set a threshold on a gray scale image.
% https://www.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image?s_tid=srchtitle
[lowThreshold, highThreshold] = threshold(lowThreshold, highThreshold, grayImage);
mask = grayImage >= lowThreshold & grayImage <= highThreshold;
yasmin ismail
2023 年 7 月 31 日
Image Analyst
2023 年 7 月 31 日
編集済み: Image Analyst
2023 年 7 月 31 日
@yasmin ismail you didn't define your segmentation function AnalyzeSingleImage, so of course it throws an error. Do you want to just do simple thresholding like you do later in your script? Anyway, I'm not sure what is the name of the variable that you (incorrectly) think that you must save for use later?
[EDIT] Here, I did my best to try to interpret what you've done and improve it. One thing is strange though -- your original image is pretty much binary already. Did you already segment it somehow? Or did you attach the wrong image. Anyway, again, no saving of the variable to a disk file was needed or performed so not sure why you think you need to.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
filename = 'c1-1fsr.png';
rgbImage = imread(filename);
subplot(1, 2, 1);
imshow(rgbImage);
% Now it's gray scale with range of 0 to 255.
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
title('Original Input Image', 'FontSize', fontSize);
% Now segment the image.
% Strange though -- it seems to be binary (i.e. segmented) already
% or the image is way over exposed.
outputImage = AnalyzeSingleImage(rgbImage);
% Display output image.
subplot(1, 2, 2);
imshow(outputImage); % Result of process 1
title('Output Mask Image', 'FontSize', fontSize);
msgbox('done');
%===============================================================================
% Now your segmentation app - simple global thresholding.
function mask = AnalyzeSingleImage(grayImage)
% Get the dimensions of the image.
% numberOfColorChannels should be = 1 for a gray scale image, and 3 for an RGB color image.
[rows, columns, numberOfColorChannels] = size(grayImage)
if numberOfColorChannels > 1
% It's not really gray scale like we expected - it's color.
% Use weighted sum of ALL channels to create a gray scale image.
% grayImage = rgb2gray(outputImage);
% ALTERNATE METHOD: Convert it to gray scale by taking only the green channel,
% which in a typical snapshot will be the least noisy channel.
grayImage = grayImage(:, :, 3); % Take Blue channel.
else
grayImage = grayImage; % It's already gray scale.
end
% Binarize the image.
% mask = imbinarize(grayImage);
lowThreshold = 0;
highThreshold = 220;
% Interactively and visually set a threshold on a gray scale image.
% https://www.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image?s_tid=srchtitle
% [lowThreshold, highThreshold] = threshold(lowThreshold, highThreshold, grayImage);
mask = grayImage >= lowThreshold & grayImage <= highThreshold;
end
yasmin ismail
2023 年 8 月 1 日
編集済み: yasmin ismail
2023 年 8 月 1 日
function mask = AnalyzeSingleImage(grayImage)
The same problem, grayImage is not recognized from the prevouise steps, the result from last process before segemenation with title 'Output Mask Image' wanted to be entered to segmenation app not the variable grayImage.
The output with title 'Output Mask Image' refer to image c1-1fsr.png, I saved it because I couldnt entered it automatically to segmentation app.
Thus, how to do it? how to let the output which has title 'Output Mask Image' entered to segemnation app.
grayImage is not the last output before segemenation app.
Your segemntation app imbinarize the image automaticaaly, thats why i want to use it. and I have already use threshold process before using your app but I need to imbinarize it which done easily with your app
Image Analyst
2023 年 8 月 1 日
Look, I'll run it right here in the Answers edit box:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
filename = 'c1-1fsr.png';
rgbImage = imread(filename);
subplot(1, 2, 1);
imshow(rgbImage);
% Now it's gray scale with range of 0 to 255.
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
title('Original Input Image', 'FontSize', fontSize);
% Now segment the image.
% Strange though -- it seems to be binary (i.e. segmented) already
% or the image is way over exposed.
outputImage = AnalyzeSingleImage(rgbImage);
rows = 895
columns = 589
numberOfColorChannels = 3
% Display output image.
subplot(1, 2, 2);
imshow(outputImage); % Result of process 1
title('Output Mask Image', 'FontSize', fontSize);
msgbox('done');
%===============================================================================
% Now your segmentation app - simple global thresholding.
function mask = AnalyzeSingleImage(grayImage)
% Get the dimensions of the image.
% numberOfColorChannels should be = 1 for a gray scale image, and 3 for an RGB color image.
[rows, columns, numberOfColorChannels] = size(grayImage)
if numberOfColorChannels > 1
% It's not really gray scale like we expected - it's color.
% Use weighted sum of ALL channels to create a gray scale image.
% grayImage = rgb2gray(outputImage);
% ALTERNATE METHOD: Convert it to gray scale by taking only the green channel,
% which in a typical snapshot will be the least noisy channel.
grayImage = grayImage(:, :, 3); % Take Blue channel.
else
grayImage = grayImage; % It's already gray scale.
end
% Binarize the image.
% mask = imbinarize(grayImage);
lowThreshold = 0;
highThreshold = 220;
% Interactively and visually set a threshold on a gray scale image.
% https://www.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image?s_tid=srchtitle
% [lowThreshold, highThreshold] = threshold(lowThreshold, highThreshold, grayImage);
mask = grayImage >= lowThreshold & grayImage <= highThreshold;
end
See it runs. I'm not sure what you mean when you say that the input argument variable is not existing before this call (line of code):
outputImage = AnalyzeSingleImage(rgbImage);
rgbImage certainly does exist. I think you must not have had much coding experience where you call functions or subroutines or methods. The name of the variables in the main, calling program can be totally different than the names you use in the function definition line. This is a very fundamental concept in programming that you need to learn. So the AnalyzeSingleImage calls the input argument grayImage and uses it, converting it to gray scale in the case where it's not, like in this case where it's an RGB image. That's perfectly fine and normal. The main program also calls the output of the function "outputImage" while in the function itself it's called "mask". Again, perfectly normal. I think you need to review the introductory training material about how to pass data to functions and get output back from those functions. You will learn that you can call the variables completely independent names in the main calling routine and the function. When you think about it it makes sense, because functions are written as a utility that could be called by any number of routines later, unknown to the function author. And those programs have their own names for the variables. It is not required for them to make copies of their variables with their preferred names to have the same name as the function. That would be VERY inconvenient and that is why it's not required. Though you CAN use the same name if you want to because the names are completely independent.
yasmin ismail
2023 年 8 月 1 日
編集済み: yasmin ismail
2023 年 8 月 1 日
@Image Analyst yes I am biggener in matlab and coding
I got this error
Unrecognized function or variable 'AnalyzeSingleImage'.
Error in recall_mat (line 31)
outputImage = AnalyzeSingleImage(rgbImage);
anyway you didnt get my point
let we assume before using your app I apply gaussian filter on RGB image ,then I want to pass the result to your app as following:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
img=imread('bb1.jpg ');
rgbImage=rgb2gray(img)
subplot(1, 2, 1);
imshow(rgbImage);
% Now it's gray scale with range of 0 to 255.
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
title('Original Input Image', 'FontSize', fontSize);
filter=imgaussfilt(img,2);
subplot(1, 2, 2);
imshow(filter); % Result of process 1
title('filtered image', 'FontSize', fontSize);
%===============================================================================
% Now your segmentation app - simple global thresholding
how to enter filter image in it
Image Analyst
2023 年 8 月 1 日
The code you posted does not call AnalyzeSingleImage at all so it can't throw that error.
And the program that DID throw that error, recall_mat.m, you forgot to attach, thus delaying a solution once more.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
PLEASE read the above so we don't waste anymore time.
yasmin ismail
2023 年 8 月 1 日
@Image Analyst i got it now , and its working
but another issue, I have the following error when I try to find width as shown:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
filename = 'c1-1fsr.png';
rgbImage = imread(filename);
subplot(1, 2, 1);
imshow(rgbImage);
% Now it's gray scale with range of 0 to 255.
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
title('Original Input Image', 'FontSize', fontSize);
% Now segment the image.
% Strange though -- it seems to be binary (i.e. segmented) already
% or the image is way over exposed.
outputImage = AnalyzeSingleImage(rgbImage);
% Display output image.
subplot(1, 2, 2);
imshow(outputImage); % Result of process 1
title('Output Mask Image', 'FontSize', fontSize);
msgbox('done');
% Now your segmentation app - simple global thresholding.
function mask = AnalyzeSingleImage(grayImage)
% Get the dimensions of the image.
% numberOfColorChannels should be = 1 for a gray scale image, and 3 for an RGB color image.
[rows, columns, numberOfColorChannels] = size(grayImage)
if numberOfColorChannels > 1
% It's not really gray scale like we expected - it's color.
% Use weighted sum of ALL channels to create a gray scale image.
% grayImage = rgb2gray(outputImage);
% ALTERNATE METHOD: Convert it to gray scale by taking only the green channel,
% which in a typical snapshot will be the least noisy channel.
grayImage = grayImage(:, :, 3); % Take Blue channel.
else
grayImage = grayImage; % It's already gray scale.
end
% Binarize the image.
% mask = imbinarize(grayImage);
lowThreshold = 0;
highThreshold = 220;
% Interactively and visually set a threshold on a gray scale image.
% https://www.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image?s_tid=srchtitle
% [lowThreshold, highThreshold] = threshold(lowThreshold, highThreshold, grayImage);
mask = grayImage >= lowThreshold & grayImage <= highThreshold;
end
% Fill holes.
mask = imfill(mask, 'holes');
subplot(2, 3, 2);
imshow(mask)
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
title('Mask', 'FontSize', fontSize)
% Take largest blob only.
% mask = bwareafilt(mask, 1);
% Compute the skeleton
skelImage = bwskel(mask);
% Find the areas of all the skeletons.
props = regionprops(skelImage, 'Area');
allAreas = sort([props.Area])
% Extract only skeletons longer than 60 pixels.
skelImage = bwareaopen(skelImage, 60);
subplot(2, 3, 3);
imshow(skelImage)
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
title('Thinned', 'FontSize', fontSize)
% Enlarge figure to full screen.
g = gcf;
g.WindowState = 'maximized';
% Compute the Euclidean distance image.
edtImage = bwdist(~mask);
subplot(2, 3, 4);
imshow(edtImage, [])
title('Distance Transform Image', 'FontSize', fontSize);
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
% Multiply them to get an image where the only pixels in the image
% are along the skeleton and their value is the radius.
% Multiply radius image by 2 to get diameter image.
diameterImage = 2 * edtImage .* single(skelImage);
subplot(2, 3, 5);
imshow(diameterImage, [])
title('Diameter Image', 'FontSize', fontSize);
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
% Get the widths. These will be where the image is not zero.
widths = diameterImage(diameterImage > 0);
% Show histogram of widths.
subplot(2, 3, 6);
histogram(widths);
grid on;
xlabel('Width in Pixels', 'FontSize', fontSize);
ylabel('Count', 'FontSize', fontSize);
% Compute the mean width
meanWidth = mean(widths)
% Put a line on the histogram at the mean width
xline(meanWidth, 'LineWidth', 2, 'Color', 'r');
caption = sprintf('Histogram of Widths. Mean Width = %.1f Pixels', meanWidth);
title(caption, 'FontSize', fontSize);
message = sprintf('Mean Width = %.1f Pixels', meanWidth);
msgbox(message);
The error is:
Error: File: Untitled2.m Line: 49 Column: 1
Function definitions in a script must appear at the end of the file.
Move all statements after the "AnalyzeSingleImage" function definition to before the first local
function definition.
can you help me to fix it, please?
Image Analyst
2023 年 8 月 1 日
See in my code where at the end of AnalyzeSingleImage it has this:
mask = grayImage >= lowThreshold & grayImage <= highThreshold;
end
The end is important. Whenever you have a function in a script, the function must come AFTER the script and must end with an "end". You can't do what you tried, and that is to continue on with the script after the function has been defined. You did
% Fill holes.
mask = imfill(mask, 'holes');
subplot(2, 3, 2);
and so on. No, you can't do that because then it would be like AnalyzeSingleImage is inserted into the middle of your script rather than at the end. That's not allowed. All functions must follow all script lines, not be placed in the middle of your script.
yasmin ismail
2023 年 8 月 2 日
@Image Analyst what i understood that skelotnize proess to find the width cannt be after end of function
Thus, how to solve it? . I cannt do it before function because I have to binarize it first then fill holes and so on
Image Analyst
2023 年 8 月 2 日
If you use a function like AnalyzeSingleImage, it MUST be defined AFTER all your script functions, or else be in a separate AnalyzeSingleImage.m m-file. So from this:
function mask = AnalyzeSingleImage(grayImage)
all the way down to the final
end % of the AnalyzeSingleImage function definition
of the function must ALL be at the very end of your script.
You can still CALL the function above its definition, anywhere and as many times as you want in your script. It just has to be DEFINED at the bottom.
yasmin ismail
2023 年 8 月 2 日
@Image Analyst I did it but still error
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
filename = 'c1-1fsr.png';
rgbImage = imread(filename);
subplot(1, 2, 1);
imshow(rgbImage);
% Now it's gray scale with range of 0 to 255.
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
title('Original Input Image', 'FontSize', fontSize);
% Now segment the image.
% Strange though -- it seems to be binary (i.e. segmented) already
% or the image is way over exposed.
outputImage = AnalyzeSingleImage(rgbImage);
% Display output image.
subplot(1, 2, 2);
imshow(outputImage); % Result of process 1
title('Output Mask Image', 'FontSize', fontSize);
msgbox('done');
% Now your segmentation app - simple global thresholding.
function mask = AnalyzeSingleImage(grayImage)
% Get the dimensions of the image.
% numberOfColorChannels should be = 1 for a gray scale image, and 3 for an RGB color image.
[rows, columns, numberOfColorChannels] = size(grayImage)
if numberOfColorChannels > 1
% It's not really gray scale like we expected - it's color.
% Use weighted sum of ALL channels to create a gray scale image.
% grayImage = rgb2gray(outputImage);
% ALTERNATE METHOD: Convert it to gray scale by taking only the green channel,
% which in a typical snapshot will be the least noisy channel.
grayImage = grayImage(:, :, 3); % Take Blue channel.
else
grayImage = grayImage; % It's already gray scale.
end
% Binarize the image.
% mask = imbinarize(grayImage);
lowThreshold = 0;
highThreshold = 220;
% Interactively and visually set a threshold on a gray scale image.
% https://www.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image?s_tid=srchtitle
% [lowThreshold, highThreshold] = threshold(lowThreshold, highThreshold, grayImage);
mask = grayImage >= lowThreshold & grayImage <= highThreshold;
% Fill holes.
mask = imfill(mask, 'holes');
subplot(2, 3, 2);
imshow(mask)
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
title('Mask', 'FontSize', fontSize)
% Take largest blob only.
% mask = bwareafilt(mask, 1);
% Compute the skeleton
skelImage = bwskel(mask);
% Find the areas of all the skeletons.
props = regionprops(skelImage, 'Area');
allAreas = sort([props.Area])
% Extract only skeletons longer than 60 pixels.
skelImage = bwareaopen(skelImage, 60);
subplot(2, 3, 3);
imshow(skelImage)
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
title('Thinned', 'FontSize', fontSize)
% Enlarge figure to full screen.
g = gcf;
g.WindowState = 'maximized';
% Compute the Euclidean distance image.
edtImage = bwdist(~mask);
subplot(2, 3, 4);
imshow(edtImage, [])
title('Distance Transform Image', 'FontSize', fontSize);
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
% Multiply them to get an image where the only pixels in the image
% are along the skeleton and their value is the radius.
% Multiply radius image by 2 to get diameter image.
diameterImage = 2 * edtImage .* single(skelImage);
subplot(2, 3, 5);
imshow(diameterImage, [])
title('Diameter Image', 'FontSize', fontSize);
impixelinfo; % Let user mouse around and see values in the status line at the lower right.
% Get the widths. These will be where the image is not zero.
widths = diameterImage(diameterImage > 0);
% Show histogram of widths.
subplot(2, 3, 6);
histogram(widths);
grid on;
xlabel('Width in Pixels', 'FontSize', fontSize);
ylabel('Count', 'FontSize', fontSize);
% Compute the mean width
meanWidth = mean(widths)
% Put a line on the histogram at the mean width
xline(meanWidth, 'LineWidth', 2, 'Color', 'r');
caption = sprintf('Histogram of Widths. Mean Width = %.1f Pixels', meanWidth);
title(caption, 'FontSize', fontSize);
message = sprintf('Mean Width = %.1f Pixels', meanWidth);
msgbox(message);
end
Unrecognized function or variable 'fontSize'.
Error in Untitled2>AnalyzeSingleImage (line 52)
title('Mask', 'FontSize', fontSize)
Error in Untitled2 (line 18)
outputImage = AnalyzeSingleImage(rgbImage);
Image Analyst
2023 年 8 月 3 日
You need to also define fontSize inside AnalyzeSingleImage(). Since it was not passed in via the argument list, the function has no idea what that is, so you need to assign it to some value, like you did in the main program.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)