提交 970befc1 编写于 作者: J joey12300

merge the visualize.py

上级 882e145a
......@@ -9,12 +9,11 @@ color_map = [[128, 64, 128], [244, 35, 231], [69, 69, 69], [102, 102, 156],
[0, 0, 230], [119, 10, 32]]
im = cv2.imread(sys.argv[1])
# Please note (224, 224) just for daheng model
shape = im.shape
print("visualizing...")
for i in range(0, 224):
for j in range(0, 224):
for i in range(0, shape[0]):
for j in range(0, shape[1]):
im[i, j] = color_map[im[i, j, 0]]
cv2.imwrite(sys.argv[1], im)
cv2.imwrite(sys.argv[2], im)
print("visualizing done!")
......@@ -123,31 +123,21 @@ int ReaderOp::inference() {
const int HH = _image_8u_tmp.rows;
const int WW = _image_8u_tmp.cols;
const int CC = _image_8u_tmp.channels();
//HH: cols WW:rows
in_width_vec->push_back(HH);
in_height_vec->push_back(WW);
// resize/crop
// resize
if (_image_8u_tmp.cols != resize.width ||
_image_8u_tmp.rows != resize.height) {
// int short_egde = std::min<int>(_image_8u_tmp.cols, _image_8u_tmp.rows);
// int yy = static_cast<int>((_image_8u_tmp.rows - short_egde) / 2);
// int xx = static_cast<int>((_image_8u_tmp.cols - short_egde) / 2);
// _image_8u_tmp =
// cv::Mat(_image_8u_tmp, cv::Rect(xx, yy, short_egde, short_egde));
// if (_image_8u_tmp.cols != resize.width ||
// _image_8u_tmp.rows != resize.height) {
cv::Mat resize_image;
// cv::resize(_image_8u_tmp, resize_image, resize);
// _image_8u_tmp = resize_image;
// }
//
cv::resize(_image_8u_tmp, resize_image, resize);
_image_8u_tmp = resize_image;
LOG(INFO) << "Succ crop one image[CHW=" << _image_8u_tmp.channels()
<< ", " << _image_8u_tmp.cols << ", " << _image_8u_tmp.rows
<< "]"
<< " from image[CHW=" << CC << ", " << HH << ", " << WW << "]";
cv::resize(_image_8u_tmp, resize_image, resize);
_image_8u_tmp = resize_image;
LOG(INFO) << "Succ crop one image[CHW=" << _image_8u_tmp.channels()
<< ", " << _image_8u_tmp.cols << ", " << _image_8u_tmp.rows
<< "]"
<< " from image[CHW=" << CC << ", " << HH << ", " << WW << "]";
}
// BGR->RGB transformer
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册