| | |
| | | |
| | | func TestPushImgMsg() { |
| | | InitService() |
| | | proImg := readImgFile() |
| | | |
| | | if b, err := proto.Marshal(&proImg);err !=nil{ |
| | | i := readImgFile() |
| | | if b, err := proto.Marshal(&i);err !=nil{ |
| | | fmt.Println("protoImage marshal err") |
| | | return |
| | | } else { |
| | |
| | | fmt.Println("file not exist") |
| | | return i |
| | | } |
| | | width := int32(picMat.Rows()) |
| | | height := int32(picMat.Cols()) |
| | | data := picMat.DataPtrUint8() |
| | | fmt.Printf("width:%d,height:%d,data.length:%d,timestamp:%s",width,height,len(data),formatTimeStr) |
| | | i = protomsg.Image{ |
| | | Width:int32(picMat.Rows()), |
| | | Height:int32(picMat.Cols()), |
| | | Timestamp:formatTimeStr, |
| | | Data:[]byte(picMat.DataPtrUint8()), |
| | | Width: width, |
| | | Height: height, |
| | | Timestamp: formatTimeStr, |
| | | Data: data, |
| | | Id: timeUnix, |
| | | } |
| | | fmt.Println("gocv read img completed") |
| | | return i |
| | | } |
| | | |