答案 0 :(得分:3)
按照您的想法,第一步是边缘检测。下面的示例显示了使用MarvinJ检测边缘的热点。有了边缘,你可能会得到物体轮廓。
输入图片:
边缘检测:
survTime=np.array([400, 800, 1100, 900])
age=np.array([40, 40, 40, 40])
counter_1yr=0
counter_2yr=0
counter_3yr=0
n=1
for i in survTime:
for j in age:
if survTime[i] > 365 and age[j] < 50:
counter_1yr+=1
n+=1
continue
elif survTime[i] > 730 and age[j] < 50:
counter_2yr+=1
n+=1
continue
elif survTime[i] > 1095 and age[j] < 50:
counter_3yr+=1
n+=1
continue
print("1 year probability: ", counter_1yr/n)
print("2 year probability: ", counter_2yr/n)
print("3 year probability: ", counter_3yr/n)
&#13;
var canvas = document.getElementById("canvas");
image = new MarvinImage();
image.load("https://i.imgur.com/ZHgkM9w.jpg", imageLoaded);
function imageLoaded(){
var imageOut = new MarvinImage(image.getWidth(), image.getHeight());
// Edge Detection (Prewitt approach)
Marvin.prewitt(image, imageOut);
// Invert color
Marvin.invertColors(imageOut, imageOut);
// Threshold
Marvin.thresholding(imageOut, imageOut, 220);
imageOut.draw(canvas);
}
&#13;
答案 1 :(得分:1)
我按照MarkE的建议使用了JsFeat,干杯!