We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
My code as follows:
122 cv::Mat im_ori = cv::imread(image_file, 1); 123 /* 124 * preprocess image as Inception_v3 required 125 * crop -> resize -> normlize (-mean)/std 126 / 127 int short_edge; 128 if(im_ori.rows > im_ori.cols) 129 { 130 short_edge = im_ori.cols; 131 } 132 else 133 { 134 short_edge = im_ori.rows; 135 } 136 //printf("image size, row = %d, col = %d, short_edge = %d\n", im_ori.rows, im_ori.cols, short_edge); 137 int yMin = (im_ori.rows - short_edge) / 2; 138 int xMin = (im_ori.cols - short_edge) / 2; 139 int xMax = xMin + short_edge; 140 int yMax = yMin + short_edge; 141 cv::Mat croppedImg; 142 im_ori(cv::Rect(xMin,yMin,xMax,yMax)).copyTo(croppedImg); 143 //cv::imwrite("ori.jpg", im_ori); 144 //cv::imwrite("crop.jpg", croppedImg); 145 146 cv::Mat im; 147 resize(croppedImg, im, resize_size); 148 //cv::imwrite("resize.jpg", im); 149 int size = im.rows * im.cols; 150 mx_float ptr_image_r = image_data; 151 for(int i = 0; i < im.rows; i++) 152 { 153 uchar* data = im.ptr(i); 154 for(int j = 0; j < im.cols; j++) 155 { 156 mx_float r = (data[j] * 256 - 128) / 128.0; 157 *ptr_image_r++ = r; 158 } 159 }
I read preprocessing.py, it first crop, then resize, at last normalization.
Are my codes wrong?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
My code as follows:
I read preprocessing.py, it first crop, then resize, at last normalization.
Are my codes wrong?
The text was updated successfully, but these errors were encountered: