I created a matlab gui to determine the length and width of a foot, the area of an existing foot, and use it to determine the size of the foot as well. here is the code I used
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I created a matlab gui to determine the length and width of a foot, the area of an existing foot, and use it to determine the size of the foot as well. here is the code I used. but why do the results tend to be invalid, is there a solution?
a=getappdata(0,'a');
a_gray=rgb2gray(a);
axes(handles.axes2);
imshow(a_gray);
% Menetapkan ambang batas (contoh: ambang batas = 150, sesuaikan sesuai kebutuhan)
threshold = 115;
% Membuat mask untuk piksel cerah
brightPixelsMask = a_gray > threshold;
% Menampilkan gambar grayscale yang hanya menyoroti piksel cerah di axes 2
imshow(brightPixelsMask, 'Parent', handles.axes2);
% Menghitung panjang dan lebar dari area cerah
stats = regionprops(brightPixelsMask, 'MajorAxisLength', 'MinorAxisLength');
if ~isempty(stats)
majorAxisLength = stats.MajorAxisLength;
minorAxisLength = stats.MinorAxisLength;
% Menampilkan hasil di static text
resultString = sprintf('Panjang: %.2f pixel, Lebar: %.2f pixel', majorAxisLength, minorAxisLength);
set(handles.text3, 'String', resultString);
% Meminta pengguna untuk memasukkan nilai resolusi
prompt = 'Masukkan nilai resolusi (PPI):';
dlgTitle = 'Input Resolusi';
numLines = 1;
defaultResolusi = '300'; % Nilai default
answer = inputdlg(prompt, dlgTitle, numLines, {defaultResolusi});
if ~isempty(answer)
% Mengambil nilai resolusi dari masukan pengguna
resolusiScanner = str2double(answer{1});
% Menghitung panjang dan lebar dalam milimeter
panjang_mm = (majorAxisLength / resolusiScanner) * 2540 * 10;
lebar_mm = (minorAxisLength / resolusiScanner) * 2540 * 10;
% Menampilkan hasil akhir di static text
resultStringFinal = sprintf('Panjang: %.2f mm, Lebar: %.2f mm', panjang_mm, lebar_mm);
set(handles.text3, 'String', resultStringFinal);
else
% Jika pengguna membatalkan pemilihan resolusi
set(handles.text3, 'String', 'Pemilihan resolusi dibatalkan.');
end
else
% Jika tidak ada area cerah, tampilkan pesan kosong
set(handles.text3, 'String', 'Tidak ada area cerah.');
end
5 Kommentare
Walter Roberson
am 1 Apr. 2024
No, the results of the foot scan in jpeg format cannot simultaneously store heat and pressure. JPEG can store only one value per location, so you would need two jpeg to store both heat and pressure.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Preview and Device Configuration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!