Skip to content
This repository was archived by the owner on Aug 10, 2022. It is now read-only.
This repository was archived by the owner on Aug 10, 2022. It is now read-only.

How do I create a Python bytes object #54

Description

@Jonathan1045

I wanted to pass a byte object to my python code but I have no idea with it:

my code:

        facedetect := ImportModule("./hello", "facedetect")
	getFaceStr := facedetect.GetAttrString("getFaceStr") // my python function to get face info

	webcam, _ := gocv.OpenVideoCapture(1)
	img := gocv.NewMat()
	webcam.Read(&img)
	buf := img.ToBytes() // the object to pass in python function
	face_buffer := python3.PyTuple_New(1)
	//buffer = buf
	python3.PyTuple_SetItem(face_buffer, 0,buf)  // how do I pass a Python bytes object
	face_res := getFaceStr.Call(face_buffer, python3.Py_None)
	log.Println(face_res)

thank you so much for your help !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions