NickM-27 / swatch

Color detection in images to capture presense of known objects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Support]: colortest API fails with an internal error (500)

heisenberg2980 opened this issue · comments

Describe the problem you are having

When trying to call the colortest API (/api/colortest/values) from postman with an image a 500 Internal Server Error is returned:

image

Version

3.1.0

Swatch config file

N/A

Relevant log output

<!doctype html>
<html lang=en>
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or
	there is an error in the application.</p>

Any other information that may be helpful

I have also tried using the Color Playground option from the UI, but after entering the URL of the camera I haven´t found a way to crop the image as indicated in the text:

image

No response

same here

@NickM-27 the colortest API is an important part of this amazing project, any chance you can look into this issue or guide us on how to debug it and fix it? happy to provide any logs

what type of image was submitted / what was the url

The api is returning the same error with every image I try, the url is in the screenshot I attached: http://192.168.0.253:4500/api/colortest/values

This is the picture I am using
test_image

not sure, when I passed http://192.168.50.106:5000/api/front_cam/latest.jpg to the frontend and it calls the backend api the color testx works as expected.

@NickM-27 can you try to call the "/api/colortest/values" endpoint using my image to see if it works for you?

Also as I mentioned in the issue I also tried using the Color Playground option from the UI, but after entering the URL of the camera I didn´t find a way to crop the image, so that option is not useful either, is there a way to crop the image in the UI?

I mean even if it is the full image you can still see how different color values affect that part of the image just the same.

When I was running things I used the zone feature and then used the url from the swatch api for that zone to use the color tuner. It could be improved in the future most likely

@NickM-27 how do you get the url from the swatch api for a zone?

The problem is that not having the /api/colortest available makes it hard as there is no help in term of dominant color, this is the error from the logs just in case it helps:

[2023-10-02 19:09:47,442]: ERROR - Exception on /colortest/values [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1519, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1517, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1503, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/opt/swatch/swatch/http.py", line 91, in test_colors
    main_color, palette = current_app.image_processor.parse_colors_from_image(
AttributeError: 'ImageProcessor' object has no attribute 'parse_colors_from_image'

@NickM-27 I just realised you updated this container 3 days ago to fix this issue, thanks!!

I cannot test it yet as the update has not appeared in Home Assistant, do you know how long it takes for the updated version to be available in Home Assistant?

I updated the container but now for me the container is failing to start entirely, don't have time to look in to why right now

Im also having issues with the container starting. #62