Open Mv face_detection over wifi

i am doing a project on face detection over wifi streaming.Faces are being detected in the ide but not in the browser over wifi. Please help me out in this.i am attaching my code .

# MJPEG Streaming AP.
# This example shows off how to do MJPEG streaming in AccessPoint mode.
# Chrome, Firefox and MJpegViewer App on Android have been tested.
# Connect to OPENMV_AP and use this URL: to view the stream.

import sensor, image, time, network, usocket, sys

SSID ='OPENMV_AP'    # Network SSID
KEY  ='1234567890'    # Network key (must be 10 chars)
HOST = ''           # Use first available interface
PORT = 8080         # Arbitrary non-privileged port

# Reset sensor

# Set sensor settings

# Load Haar Cascade
# By default this will use all stages, lower satges is faster but less accurate.
face_cascade = image.HaarCascade("frontalface", stages=25)

# Init wlan module in AP mode.
wlan = network.WINC(mode=network.WINC.MODE_AP)
wlan.start_ap(SSID, key=KEY, security=wlan.WEP, channel=2)

# You can block waiting for client to connect

def start_streaming(s):
    print ('Waiting for connections..')
    client, addr = s.accept()
    # set client socket timeout to 2s
    print ('Connected to ' + addr[0] + ':' + str(addr[1]))

    # Read request from client
    data = client.recv(1024)
    # Should parse client request here

I am unable to upload the complete code…

This is the code… Please guide me to solve this. I am kind of beginner in networking and socket programming.
openmv forum.txt (3.16 KB)

Hi, Ibrahim will be able to help you in a bit.

Thank you, waiting for your help…

Um, yeah, so, what are you trying to do and what exactly is wrong? You didn’t specify what actually isn’t working. You just posted some code with no indication what you are trying to communicate with.

Actually I am trying to view the detected faces over wifi. But, unsuccessful… I am not being able to send the faces through the socket… The video is being transmitted, but face detection is not… I have tried by changing the socket to a Tcp socket. But, I am not getting the idea that how to send the algorithm " for r in objects
Img.draw_rectangle(r)" over wifi… This is where I am stucked. Please help me out. I am trying for a long period and I have been through many videos and tutorials but unsuccessful…

Hi, you haven’t described what application is receiving your data. A socket has to connect to some device and send the data to it. If you want to do a WiFi based application you need to think about what will receive the data and clearly define a protocol for that reception.

You draw after compressing the image, try moving compressed() after drawing.

Hello sir,
I have tried, but we can’t draw after compression… Rest of the code is working well, but I need to pack the draw_rectangle algorithm so that we can send it to wifi socket using client.send().

I have created the socket and the whole function to send and rechive the data.
openmv forum.txt (3.16 KB)

Hello sir,
We are viewing the video in a chrome browser. And we will try to see the video in a mjpeg video streaming app.

Hello sir,
I have tried, but we can’t draw after compression…

You draw after compression, so you send the image before drawing, you should draw before compression. It’s not that hard really, just do this:

        for r in objects:
        cframe = img.compressed(quality=35)

Thank you so much sir. It is working…