事前のガウス平滑化(pyrDown C ++関数によって実行される)なしでOpenCV 2.3.1で画像をダウンサンプリングする組み込みの方法はありますか?
ありがとう。
たぶんあなたはresize()を探しています。
# Python code:
import cv2
large_img = cv2.imread('our_large_image.jpg')
small_to_large_image_size_ratio = 0.2
small_img = cv2.resize(large_img, # original image
(0,0), # set fx and fy, not the final size
fx=small_to_large_image_size_ratio,
fy=small_to_large_image_size_ratio,
interpolation=cv2.INTER_NEAREST)
代わりに、これらの補間方法interpolation=cv2.INTER_NEAREST
のいずれかを使用できます。
補間=INTER_NEARESTのresize()。
編集
うーん、自分で関数を書いたらどうなる?
double factor;
int newcols = round(mat.cols*factor);
int newrows = round(mat.rows*factor);
Mat newmat = Mat(newcol, newrows, mat.type());
for (int i=0;i<mat.cols;i++){
for (int j=0;j<mat.cols;j++){
newmat_<yourtype> (round(i*factor), round(j*factor)) = mat_<yourtype>(i, j);
}
}
コードが機能するかどうか(おそらく機能しない)を確認していませんが、あなたはその考えを理解しています。
Image Pyramids:pyrDownを使用できます。opencvドキュメントのリンクは http://docs.opencv.org/2.4/doc/tutorials/imgproc/pyramids/pyramids.htmlです。