Skip to content

Commit 0797f62

Browse files
authored
Merge pull request #492 from sam575/patch-1
Fix rgb -> bgr while image loading and displaying
2 parents 7d106c9 + c1bd420 commit 0797f62

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎demo.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,12 @@ def _get_image_blob(im):
263263
im_file = os.path.join(args.image_dir, imglist[num_images])
264264
# im = cv2.imread(im_file)
265265
im_in = np.array(imread(im_file))
266-
if len(im_in.shape) == 2:
267-
im_in = im_in[:,:,np.newaxis]
268-
im_in = np.concatenate((im_in,im_in,im_in), axis=2)
269-
# rgb -> bgr
270-
im = im_in[:,:,::-1]
266+
if len(im_in.shape) == 2:
267+
im_in = im_in[:,:,np.newaxis]
268+
im_in = np.concatenate((im_in,im_in,im_in), axis=2)
269+
# rgb -> bgr
270+
im_in = im_in[:,:,::-1]
271+
im = im_in
271272

272273
blobs, im_scales = _get_image_blob(im)
273274
assert len(im_scales) == 1, "Only single-image batch implemented"
@@ -366,8 +367,7 @@ def _get_image_blob(im):
366367
result_path = os.path.join(args.image_dir, imglist[num_images][:-4] + "_det.jpg")
367368
cv2.imwrite(result_path, im2show)
368369
else:
369-
im2showRGB = cv2.cvtColor(im2show, cv2.COLOR_BGR2RGB)
370-
cv2.imshow("frame", im2showRGB)
370+
cv2.imshow("frame", im2show)
371371
total_toc = time.time()
372372
total_time = total_toc - total_tic
373373
frame_rate = 1 / total_time

0 commit comments

Comments
 (0)