2014-02-06 77 views

回答

1

考慮您正在使用cv::Mat的事實。你有沒有考慮過使用colRange(int startcol, int endcol)

image.colRange(j-one_count - 1, j - 2) = 0; 
+0

我在這個問題上傳Matlab和C++相關的這個算法看一看 http://stackoverflow.com/questions/21607017/attempt-to-implementation-running-length-smoothing-algorithm-in-c – sayvortana

0

使用範圍功能 你可以用它如下

image(Range(i,i+1),Range(j-one_count:j-1)) = Mat::zeros(1,j-one_count:j-1,image.type()); 

Range(a,b) can be used to get row/column from [a,b). ie from row/column a to row/column b-1 

你也不能只是直接分配值0。您可以將相同大小的零矩陣指定爲從圖像中拍攝的子矩陣。