我想使用霍夫圆检测加速图像处理。
// For all rows in image:
for y:=0 to AnalysisBitmap.Height-1 do
begin
// For all pixel in one row :
for x:=0 to AnalysisBitmap.Width-1 do
begin
// Is there a point ?
if IsPixel(x,y, AnalysisBitmap, 128 ) then
begin
for theta:=0 to max_theta do
begin
TestPoint.x := round ( x - r * cos(theta*PI/max_theta) );
TestPoint.y := round ( y - r * sin(theta*PI/max_theta));
if ((testPoint.x < ImageWidth) and (testPoint.x > 0 ) and
(testPoint.y < ImageHeight ) and (testPoint.y > 0 ) ) then Inc(aHoughResult[TestPoint.x,TestPoint.y]);
end;
end;
end;
end;
由于 VCL 位图不是线程安全的,我想我只能对内部 Theta Loop 进行并行处理?加速此代码的最佳方法是什么。