我正在尋找在圖片上繪制實線并顯示繪制線的長度的最簡單方法。附上一張圖片。有什么想法可以在win7下做嗎?謝謝
例子
uj5u.com熱心網友回復:
最簡單的方法是在瀏覽器中轉到ImageJ,然后單擊:
File -> Open Sample -> Cardio
然后單擊Line Tool并繪制線條。它會在資訊視窗中告訴您長度。
您同樣可以在本地安裝它,但這會更難。
您可以輕松地使用Photopea。
uj5u.com熱心網友回復:
繪制一條線需要坐標。那么就可以從等式計算線的長度: length = sqrt((Xend - Xstart)^2 (Yend - Ystart)^2 )。根據問題中提到的那個例子:您可以為每一行創建一個回圈來存盤第一個彩色像素和最后一個彩色像素的值,計算它們之間的長度并將結果與??下一行進行比較。在輔助變數中可以存盤最大的結果(每行計算后實作)
// C Implementation for drawing line
#include <graphics.h>
// driver code
int main()
{
// gm is Graphics mode which is a computer display
// mode that generates image using pixels.
// DETECT is a macro defined in "graphics.h" header file
int gd = DETECT, gm;
// initgraph initializes the graphics system
// by loading a graphics driver from disk
initgraph(&gd, &gm, "");
// line for x1, y1, x2, y2
line(150, 150, 450, 150);
// line for x1, y1, x2, y2
line(150, 200, 450, 200);
// line for x1, y1, x2, y2
line(150, 250, 450, 250);
getch();
// closegraph function closes the graphics
// mode and deallocates all memory allocated
// by graphics system .
closegraph();
}
您可以使用 C ,例如 CodeBlocks。但要開始最好的是處理https://processing.org/reference/line_.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/322396.html
上一篇:型別錯誤:reduce_sum()得到了一個意外的關鍵字引數“reduction_indices”?
下一篇:如何將3個通道轉換為RGB影像?
