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
採用された回答
KALYAN ACHARJYA
2019 年 6 月 30 日
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!!
KALYAN ACHARJYA
2019 年 6 月 30 日
A simple for loop calculating the mean and standard deviation is my aim!!
Lest one objective at a time: Mean
Input data?? Mean of ??
Matpar
2019 年 6 月 30 日
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!
KALYAN ACHARJYA
2019 年 6 月 30 日
編集済み: KALYAN ACHARJYA
2019 年 6 月 30 日
Matpar
2019 年 6 月 30 日
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!
KALYAN ACHARJYA
2019 年 6 月 30 日
編集済み: KALYAN ACHARJYA
2019 年 6 月 30 日
Thats why I am asking, please provide the input? Mean of what?? Any array?
Pls elaoborate with example (Maths)?
Matpar
2019 年 6 月 30 日
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]
KALYAN ACHARJYA
2019 年 6 月 30 日
編集済み: KALYAN ACHARJYA
2019 年 6 月 30 日
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.
Matpar
2019 年 6 月 30 日
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
Image Analyst
2019 年 6 月 30 日
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!!
Matpar
2019 年 7 月 1 日
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!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)
