simplest adaptive thresholding custom code
显示 更早的评论
Hi all,
I got this far with the adaptive thresholding, Can a professional explain my errors please?
i am trying to do an adaptive thresholding via (Custom For Loop)manual coding!!
I am not sure if this can work! need a break down of what should happen please!!
Thanks in advance!!
function adthres;
[row col]=size(x);
for i=1:1:n
for j=1:n
x = i - n/2;
y = j - n/2;
j(i,j) = exp(-(x*x)/two_sigma_sq);
end
end
end
采纳的回答
adaptive thresholding menas, the threshold value is not fixed, its depends on image or input data
In the first view, This code is messed. As you defined j=1:n, here j is scalar, also j(i,j)>> Here j >> representing vector. I didnot find any statement, which relate to calculate the threshold value or replacing vector elements based the threshold.
some_vector(i,j)=exp(-(x*x)/two_sigma_sq);
This statement finding the each element of 2D vector/matrix
13 个评论
I know my code is a mess and I am trying to understand what I am doing!
Can you give me an example of what it should be? So in the future I can reference that example and learn progressively!!
A simple for loop calculating the mean and standard deviation is my aim!!
Can you or anyone provide and example of this please? So that I can learn the processes and it's requirements!
Thank you for aacknowledging my digital presence!!
A simple for loop calculating the mean and standard deviation is my aim!!
Lest one objective at a time: Mean
Input data?? Mean of ??
Ok! I am following your lead i really would like to learn and understand this @KALYAN ACHARJYA! Seeing that my values and understanding is off, you chose! Thank you for responding!
Thanks once more @ KALYAN ACHARJYA! I have seen those/your example, that is not my issue. I am having trouble doing it as a for loop! implementing the mean in a for loop as well as the standard deviation. I was hoping you can provide a demonstration of the task in the simplest form so that I can comprehend it. I have been searching online for an example that shows this so that i can go over it on my own, so that it sticks....
Please assist anticipating your response positively!
Thats why I am asking, please provide the input? Mean of what?? Any array?
Pls elaoborate with example (Maths)?
can you help me do a for loop for these arrays please?
threshold = 30
Standard Dev x = [2 2 4; 3 1 2; 6 2 3];
utilisng this mean x = [0 1 1; 1 1 2]
Sorry I didnot get the question. Loop is use to do just reapeating task. The question is, loop use to calculate ??
I assumed, you know the basic of loop.
yes I understand the basic loop but I am trying to understand how to do adaptive threshold via a for loop!! To do this adaptive threshold, does it require calculating the mean as well as standard deviation? I have been reading but some how I am not getting it. I deceided to see this happen as an example so that it would be a little clearer!
Thank for responding and acknowledging me!
this is normal thresholding, I am not sure how to do the mean calculation in the same code for adaptive thresholding, This where i reach :
function Car = Thresholding(Gcar)
[rows, cols] = size(Gcar);
Car = zeros(rows, cols);
for i = 1:r
for j = 1:c
if Gcar(i,j) > 100
Car(i,j) = 1;
end
end
end
Replace all that with these simple two lines of code:
function Car = Thresholding(Gcar)
Car = Gcar > 100;
No for loops at all needed.
Hi thanks for responding @ Image Analyst! But i still ould liketo understand it utilisng the for loops!! can you guide me in the right direction please?
I understood the;
function Car = Thresholding(Gcar)
Car = Gcar > 100;
but still would like to solve the adaptive threshold via for loop and thanks in advance for responding and acknowledging my comments and anwers!!
Hi @ Image Analysis,
Can you help me understand this Error Please?
Error using images.internal.imageDisplayValidateParams>validateCData (line 119)
If input is logical (binary), it must be two-dimensional.
Error in images.internal.imageDisplayValidateParams (line 27)
common_args.CData = validateCData(common_args.CData,image_type);
Error in images.internal.imageDisplayParseInputs (line 78)
common_args = images.internal.imageDisplayValidateParams(common_args);
Error in imshow (line 246)
images.internal.imageDisplayParseInputs({'Parent','Border','Reduce'},preparsed_varargin{:});
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 File Operations 的更多信息
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 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)
