翻译代码: readimage(11\basketball\ f332.jpg,image) ; showimage(image) : showimage(image) : drawrectangle(rect) ; initial_meanshift(image,rect,16) ; for (index=333,487,1); cstringformat("11\basketball\f%d.jpg,index",imagename); readimage(imagename,image1 ) ; run_meanshift(image1, centroidx, centroidy,left,top,right, bottom); inttodouble(centroidx, centroidx1) ; inttodouble(centroidy, centroidy1 ) ; inttodouble(left,left1); inttodouble(right,right1 ); inttodouble(top,top1); inttodouble(bottom,bottom1 ); showimage(image1 ); setcolor(2,red) ; genrectangle(left1,top1,right1, bottom1) endfor(); close_meanshift();
时间: 2023-08-21 16:02:54 浏览: 90
读取图像代码
读取图片:readimage("11/basketball/f332.jpg", image);
展示图片:showimage(image);
绘制矩形:drawrectangle(rect);
初始化meanshift算法:initial_meanshift(image, rect, 16);
循环:for (index = 333; index <= 487; index++) {
字符串格式化:cstringformat("11/basketball/f%d.jpg", index, imagename);
读取图片:readimage(imagename, image1);
运行meanshift算法:run_meanshift(image1, centroidx, centroidy, left, top, right, bottom);
将centroidx、centroidy、left、top、right、bottom转为double类型:inttodouble(centroidx, centroidx1); inttodouble(centroidy, centroidy1); inttodouble(left, left1); inttodouble(right, right1); inttodouble(top, top1); inttodouble(bottom, bottom1);
展示图片:showimage(image1);
设置颜色为红色:setcolor(2, red);
生成矩形:genrectangle(left1, top1, right1, bottom1);
}
关闭meanshift算法:close_meanshift();
阅读全文