-1

Here is my code:

enter image description here

It shows an error every time

Marcelo Paco
  • 2,732
  • 4
  • 9
  • 26
  • Welcome to Stack Overflow! Relevant code and error messages need to be included in your question *as text*, [not as pictures of text](https://meta.stackoverflow.com/q/285551/328193). Just linking to screen shots makes it more difficult for people to help you. To learn more about this community and how we can help you, please start with the [tour] and read [ask] and its linked resources. – David Apr 22 '23 at 16:39

1 Answers1

0

Reading from this git hub issue that talks about the same issue that you're having, it says the following:

This a secondary error that basically just means the image you are trying to process didn't load and was empty.

If you grabbed the image dara from the camera, it means the camera connection failed or isn't configured correctly. If you loaded an image file, it means the loading failed.

We can understand where this issue is comming from by looking at your code. The path to the image is malformed:

image = cv2.imread("r../input/C:/Users/Hp/Satellite image dataset/train_images/train/image_t8_007.jpg")

There are two issues here:

  1. There is an attempt at using a raw string, but the r should be outside of the string and not inside of it
  2. The path is a combination of a relative path and an absolute path

The imread() call should look like this:

image = cv2.imread(r"C:/Users/Hp/Satellite image dataset/train_images/train/image_t8_007.jpg")
Marcelo Paco
  • 2,732
  • 4
  • 9
  • 26