0

Im using python 3.6 and opencv 3.4 version on windows platform been trying to develop this application

enter image description here

changing the result = cv2.imread(args["result_path"] + "/" + resultID) to result = cv2.imread(args["result_path"] + "\" + resultID) didnt help

I am getting errors in search.py while displaying the result images.

cv2.imshow(“Result”, result)
cv2.error: OpenCV(3.4.1) D:\Build\OpenCV\opencv-3.4.1\modules\highgui\src\window
.cpp:364: error: (-215) size.width>0 && size.height>0 in function cv::imshow .

although I am able to display the query image but unable to see the results

# display the query
cv2.imshow("Query", query)
cv2.waitKey(0)

# loop over the results


for (score, resultID) in results:
    # load the result image and display it

    result = cv2.imread(args["result_path"] + "/" + resultID)

    cv2.imshow("Result", result)
    cv2.waitKey(0)

Any help would be appreciated

Naresh
  • 16,698
  • 6
  • 112
  • 113

1 Answers1

0

I think that the error lies in this line:

result = cv2.imread(args["result_path"] + "/" + resultID)

which needs to be changed to use os.path.join ideally, so that you don't run into platform dependent code. Also, you may need to add the file extension (".jpg" or ".png" etc to the overall path which may not be contained in the resultID variable.

An example of how to use os.path.join:

os.path.join(args["result_path"],resultID) #also possibly the file extension

I suggest printing the path obtained before trying to use cv2.imread on it and you'll probably spot the issue. Hope this helps.