Open Mv face_detection over wifi

Hi,
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: http://192.168.1.1:8080 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
sensor.reset()

# Set sensor settings
sensor.set_contrast(1)
sensor.set_brightness(1)
sensor.set_saturation(1)
sensor.set_gainceiling(16)
sensor.set_framesize(sensor.QQVGA)
sensor.set_pixformat(sensor.RGB565)

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

# 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
#print(wlan.wait_for_sta(10000))

def start_streaming(s):
    print ('Waiting for connections..')
    client, addr = s.accept()
    # set client socket timeout to 2s
    client.settimeout(2.0)
    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®" 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:
           img.draw_rectangle(r)
        cframe = img.compressed(quality=35)

Thank you so much sir. It is working…