0

How can I make a orange

Plz send a code

3rd Jun 2023, 12:40 PM
STRANGER GAMING
STRANGER GAMING - avatar
5 Réponses
+ 2
STRANGER GAMING Did you read the error messages? I tested it out and it seems correct, i just think that sololearn doesnt support cv2. maybe test it out in a different IDE
3rd Jun 2023, 4:13 PM
Junior
Junior - avatar
+ 5
Share your code and attach with relevant programming tag
3rd Jun 2023, 12:48 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 4
STRANGER GAMING A wall of text can be hard to debug so I would suggest linking a codebit. See below code for how to do so. And also, like Sakshi (Less Active) , please use better tags. https://code.sololearn.com/Wek0V1MyIR2r/?ref=app https://code.sololearn.com/W3uiji9X28C1/?ref=app
3rd Jun 2023, 1:02 PM
Justice
Justice - avatar
0
import cv2 import numpy as np # Load the image image_path = "path_to_your_image.jpg" frame = cv2.imread(image_path) # Convert the image to the HSV color space hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) # Define the lower and upper bounds for the red color range lower_red = np.array([0, 50, 50]) upper_red = np.array([10, 255, 255]) # Create a mask for red color detection mask = cv2.inRange(hsv, lower_red, upper_red) # Find contours in the mask contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) # Draw bounding boxes around flowers in red color for contour in contours: area = cv2.contourArea(contour) if area > 100: # Filter small areas to reduce noise x, y, w, h = cv2.boundingRect(contour) cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 0, 255), 2) # Display the output frame cv2.imshow("Flower Detection", frame) cv2.waitKey(0) cv2.destroyAllWindows()
3rd Jun 2023, 12:51 PM
STRANGER GAMING
STRANGER GAMING - avatar
0
This code I have make but I doesnt work why
3rd Jun 2023, 12:52 PM
STRANGER GAMING
STRANGER GAMING - avatar