Skip to content

Commit

Permalink
Merge pull request jwyang#492 from sam575/patch-1
Browse files Browse the repository at this point in the history
Fix rgb -> bgr while image loading and displaying
  • Loading branch information
jwyang committed Apr 3, 2019
2 parents 7d106c9 + c1bd420 commit 0797f62
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,12 @@ def _get_image_blob(im):
im_file = os.path.join(args.image_dir, imglist[num_images])
# im = cv2.imread(im_file)
im_in = np.array(imread(im_file))
if len(im_in.shape) == 2:
im_in = im_in[:,:,np.newaxis]
im_in = np.concatenate((im_in,im_in,im_in), axis=2)
# rgb -> bgr
im = im_in[:,:,::-1]
if len(im_in.shape) == 2:
im_in = im_in[:,:,np.newaxis]
im_in = np.concatenate((im_in,im_in,im_in), axis=2)
# rgb -> bgr
im_in = im_in[:,:,::-1]
im = im_in

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

0 comments on commit 0797f62

Please sign in to comment.