Skip to content
New issue

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

fix plt.imshow BGR image #5122

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
"\n",
"# 画出读取的图片\n",
"plt.figure(figsize=(10, 10))\n",
"plt.imshow(image)\n"
"plt.imshow(image[:, :, ::-1])\n"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,12 @@
"plt.figure()\n",
"plt.subplot(2,1,1)\n",
"# 可视化原图\n",
"plt.imshow(raw_img)\n",
"plt.imshow(raw_img[:, :, ::-1])\n",
"# 缩放并归一化\n",
"padding_im, draw_img = resize_norm_img(raw_img)\n",
"plt.subplot(2,1,2)\n",
"# 可视化网络输入图\n",
"plt.imshow(draw_img)\n",
"plt.imshow(draw_img[:, :, ::-1])\n",
"plt.show()"
]
},
Expand Down Expand Up @@ -1475,12 +1475,12 @@
"plt.figure()\n",
"plt.subplot(2,1,1)\n",
"# 可视化原图\n",
"plt.imshow(raw_img)\n",
"plt.imshow(raw_img[:, :, ::-1])\n",
"# 随机切割\n",
"crop_img = get_crop(raw_img)\n",
"plt.subplot(2,1,2)\n",
"# 可视化增广图\n",
"plt.imshow(crop_img)\n",
"plt.imshow(crop_img[:, :, ::-1])\n",
"plt.show()"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
"\n",
"img = cv2.imread('output/res_e2e/zh_val_42_ser.jpg')\n",
"plt.figure(figsize=(48,24))\n",
"plt.imshow(img)"
"plt.imshow(img[:, :, ::-1])"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
"\n",
"# 读取表格图像并显示\n",
"img = cv2.imread('/home/aistudio/1.jpg')\n",
"plt.imshow(img)"
"plt.imshow(img[:, :, ::-1])"
]
},
{
Expand Down Expand Up @@ -478,7 +478,7 @@
"# 显示输入图像\n",
"plt.subplot(1,3,1)\n",
"plt.title('src, shape:{}'.format(img.shape))\n",
"plt.imshow(img)\n",
"plt.imshow(img[:, :, ::-1])\n",
"\n",
"# 执行 ResizeTableImage\n",
"# https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/ppocr/data/imaug/gen_table_mask.py#L182\n",
Expand All @@ -491,7 +491,7 @@
"# 显示 ResizeTableImage 后的图像\n",
"plt.subplot(1,3,2)\n",
"plt.title('ResizeTableImage, shape:{}'.format(data['image'].shape))\n",
"plt.imshow(data['image'])\n",
"plt.imshow(data['image'][:, :, ::-1])\n",
"\n",
"# 执行 PaddingTableImage\n",
"# https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/ppocr/data/imaug/gen_table_mask.py#L232\n",
Expand All @@ -504,7 +504,7 @@
"# 显示 PaddingTableImage 后的图像\n",
"plt.subplot(1,3,3)\n",
"plt.title('PaddingTableImage, shape:{}'.format(data['image'].shape))\n",
"plt.imshow(data['image']/255)\n",
"plt.imshow(data['image'][:, :, ::-1]/255)\n",
"plt.show()\n",
"\n",
"# 定义完整的处理op列表\n",
Expand Down Expand Up @@ -902,7 +902,7 @@
"img_show = img.copy()\n",
"for box in res_loc_final:\n",
" cv2.rectangle(img_show, (box[0], box[1]), (box[2], box[3]), (0, 255, 0), 2)\n",
"plt.imshow(img_show)"
"plt.imshow(img_show[:, :, ::-1])"
]
},
{
Expand Down