Skip to content

how to get the annotated frame from sahi results? #884

Closed Answered by fatemehprhm
fatemehprhm asked this question in Q&A
Discussion options

You must be logged in to vote

I managed to solve it by cv library of sahi as below:

from sahi.utils.cv import visualize_object_predictions,read_image_as_pil
import numpy as np
image = read_image_as_pil(results.image)

object_predictions = visualize_object_predictions(
    image=np.ascontiguousarray(image),
    object_prediction_list=results.object_prediction_list,
    rect_th=None,
    text_size=None,
    text_th=None,
    color=None,
    hide_labels=False,
    hide_conf=False,      
    export_format="png",
)
image = object_predictions["image"]
img_msg = bridge.cv2_to_imgmsg(image)  
self.img_pub.publish(img_msg)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fatemehprhm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant