Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to compress jpg to webp? #115

Open
hurkgu opened this issue Sep 8, 2017 · 1 comment
Open

how to compress jpg to webp? #115

hurkgu opened this issue Sep 8, 2017 · 1 comment

Comments

@hurkgu
Copy link

hurkgu commented Sep 8, 2017

@lazywei not support webp?
opencv version: 2.4.13.2
os: mac os 10.12
os:

func cpmpressopencv() {
	filename := "~/Downloads/111.jpeg"
	srcImg := opencv.LoadImage(filename)
	if srcImg == nil {
		panic("Loading Image failed")
	}
	defer srcImg.Release()

	mat := opencv.EncodeImage(".webp", unsafe.Pointer(srcImg), []int{64})
	bs := mat.GetData()
	fmt.Println("********", len(bs))
}

error

OpenCV Error: Unspecified error (could not find encoder for the specified extension) in imencode, file /tmp/opencv@2-20170820-5854-pr62o6/opencv-2.4.13.2/modules/highgui/src/loadsave.cpp, line 415
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /tmp/opencv@2-20170820-5854-pr62o6/opencv-2.4.13.2/modules/highgui/src/loadsave.cpp:415: error: (-2) could not find encoder for the specified extension in function imencode

SIGABRT: abort
PC=0x7fff8e70adda m=0 sigcode=0
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x4099040, 0xc420051de8, 0xc420051e10)
	/usr/local/Cellar/go/1.8.3/libexec/src/runtime/cgocall.go:131 +0xe2 fp=0xc420051db8 sp=0xc420051d78
github.com/lazywei/go-opencv/opencv._Cfunc_cvEncodeImage(0x6e014c0, 0x6e020c0, 0xc4200103a0, 0x0)
	github.com/lazywei/go-opencv/opencv/_obj/_cgo_gotypes.go:1681 +0x4e fp=0xc420051de8 sp=0xc420051db8
github.com/lazywei/go-opencv/opencv.EncodeImage.func2(0x6e014c0, 0x6e020c0, 0xc4200103a0, 0x0)
	/Users/hurk/gopath/src/github.com/lazywei/go-opencv/opencv/highgui.go:432 +0x74 fp=0xc420051e20 sp=0xc420051de8
github.com/lazywei/go-opencv/opencv.EncodeImage(0x40cc162, 0x5, 0x6e020c0, 0xc420051ee0, 0x1, 0x1, 0x0)
	/Users/hurk/gopath/src/github.com/lazywei/go-opencv/opencv/highgui.go:432 +0x154 fp=0xc420051ea0 sp=0xc420051e20
main.cpmpressopencv()
	/Users/hurk/gopath/src/demo/webp.go:35 +0x1dc fp=0xc420051f78 sp=0xc420051ea0
main.main()
	/Users/hurk/gopath/src/demo/webp.go:11 +0x20 fp=0xc420051f88 sp=0xc420051f78
runtime.main()
	/usr/local/Cellar/go/1.8.3/libexec/src/runtime/proc.go:185 +0x20a fp=0xc420051fe0 sp=0xc420051f88
runtime.goexit()
	/usr/local/Cellar/go/1.8.3/libexec/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc420051fe8 sp=0xc420051fe0

goroutine 17 [syscall, locked to thread]:
@haze
Copy link

haze commented Aug 23, 2018

I'm not an expert on this but this could not find encoder for the specified extension in function imencode sets off an alarm in my head. Maybe try finding and installing whatever webp encoder opencv uses?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants