I need to crop image before passing into the model.
Currently I am doing this:
nccn mat to opencv mat. ---> cropping it--> again opencv: : mat to ncnn::mat ---> input to model.
following method crops image in opencv.
cv::Rect rr=cv::Rect(left,top,right-left,bottom-top);
cv::Mat face = rgbaMat(rr);
Can we achieve similar functionality with ncnn mat directly? so conversion time will be saved drastically.
thanks
@nihui
@cook
@tamworth
@LittlePeng
@donch1989
ncnn::copy_cut_border(const Mat& src, Mat& dst, int top, int bottom, int left, int right);
the parameters are the border width to cut
if I am not wrong
top- y1
bottom y2
left x1
right x2
@soham24
hey, I checked the code,
top bottom left right here are the distance from the border that you want to crop.
so:
top: y1
bottom: height - y2
left: x1
right: width - x2
Let me know if this is correct.
@jalola hey this is correct. even I have confirmed this.
@jalola @nihui Will it work on a mat which is normalized with
substract_mean_normalize()' this method?
Most helpful comment
@soham24
hey, I checked the code,
top bottom left right here are the distance from the border that you want to crop.
so:
top: y1
bottom: height - y2
left: x1
right: width - x2
Let me know if this is correct.