mirror of
https://github.com/gen2brain/cam2ip.git
synced 2025-12-15 11:58:33 +00:00
Change libjpeg library, rename tag
This commit is contained in:
24
README.md
24
README.md
@@ -21,32 +21,18 @@ You can also use apps like `ffplay` or `vlc`:
|
||||
|
||||
### Build tags
|
||||
|
||||
* `opencv` - use `OpenCV` to access camera ([gocv](https://github.com/hybridgroup/gocv))
|
||||
* `turbo` - build with `libjpeg-turbo` ([libjpeg-turbo](https://www.libjpeg-turbo.org/)) instead of native Go `image/jpeg`
|
||||
* `opencv` - use `OpenCV` library to access camera ([gocv](https://github.com/hybridgroup/gocv))
|
||||
* `libjpeg` - build with `libjpeg` ([go-libjpeg](https://github.com/pixiv/go-libjpeg)) instead of native Go `image/jpeg`
|
||||
|
||||
### Download
|
||||
|
||||
Binaries are compiled with static OpenCV/libjpeg-turbo libraries, they should just work:
|
||||
|
||||
- [Linux 64bit](https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-64bit.tar.gz)
|
||||
- [Linux 64bit OpenCV](https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-64bit-cv2.tar.gz)
|
||||
- [macOS 64bit OpenCV](https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-darwin-cv2.zip)
|
||||
- [RPi 32bit](https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-RPi.tar.gz)
|
||||
- [RPi 32bit OpenCV](https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-RPi-cv2.tar.gz)
|
||||
- [RPi 32bit Static](https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-RPi-nocgo.tar.gz)
|
||||
- [RPi3 32bit](https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-RPi3.tar.gz)
|
||||
- [RPi3 32bit OpenCV](https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-RPi3-cv2.tar.gz)
|
||||
- [Windows 32bit](https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-32bit.zip)
|
||||
- [Windows 32bit OpenCV](https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-32bit-cv2.zip)
|
||||
- [Windows 64bit](https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-64bit.zip)
|
||||
- [Windows 64bit OpenCV](https://github.com/gen2brain/cam2ip/releases/download/1.6/cam2ip-1.6-64bit-cv2.zip)
|
||||
|
||||
Download the latest binaries from the [releases](https://github.com/gen2brain/cam2ip/releases).
|
||||
|
||||
### Installation
|
||||
|
||||
go get -v github.com/gen2brain/cam2ip/cmd/cam2ip
|
||||
go install github.com/gen2brain/cam2ip/cmd/cam2ip@latest
|
||||
|
||||
This will install app in `$GOPATH/bin/cam2ip`.
|
||||
This command will install `cam2ip` in `GOBIN`, you can point `GOBIN` to e.g. `/usr/local/bin` or `~/.local/bin`.
|
||||
|
||||
### Run in Docker container
|
||||
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
//go:build turbo
|
||||
// +build turbo
|
||||
//go:build !libjpeg
|
||||
|
||||
// Package image.
|
||||
package image
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/jpeg"
|
||||
"io"
|
||||
|
||||
jpeg "github.com/antonini/golibjpegturbo"
|
||||
)
|
||||
|
||||
// NewDecoder returns a new Decoder.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//go:build !turbo
|
||||
// +build !turbo
|
||||
//go:build libjpeg
|
||||
|
||||
// Package image.
|
||||
package image
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/jpeg"
|
||||
"io"
|
||||
|
||||
"github.com/pixiv/go-libjpeg/jpeg"
|
||||
)
|
||||
|
||||
// NewDecoder returns a new Decoder.
|
||||
@@ -22,5 +22,9 @@ type Decoder struct {
|
||||
|
||||
// Decode decodes image from JPEG.
|
||||
func (d Decoder) Decode() (image.Image, error) {
|
||||
return jpeg.Decode(d.r)
|
||||
return jpeg.Decode(d.r, &jpeg.DecoderOptions{
|
||||
DCTMethod: jpeg.DCTFloat,
|
||||
DisableFancyUpsampling: true,
|
||||
DisableBlockSmoothing: true,
|
||||
})
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
//go:build turbo
|
||||
// +build turbo
|
||||
//go:build !libjpeg
|
||||
|
||||
// Package image.
|
||||
package image
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/jpeg"
|
||||
"io"
|
||||
|
||||
jpeg "github.com/antonini/golibjpegturbo"
|
||||
)
|
||||
|
||||
// NewEncoder returns a new Encoder.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//go:build !turbo
|
||||
// +build !turbo
|
||||
//go:build libjpeg
|
||||
|
||||
// Package image.
|
||||
package image
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/jpeg"
|
||||
"io"
|
||||
|
||||
"github.com/pixiv/go-libjpeg/jpeg"
|
||||
)
|
||||
|
||||
// NewEncoder returns a new Encoder.
|
||||
@@ -22,10 +22,7 @@ type Encoder struct {
|
||||
|
||||
// Encode encodes image to JPEG.
|
||||
func (e Encoder) Encode(img image.Image) error {
|
||||
err := jpeg.Encode(e.w, img, &jpeg.Options{Quality: 75})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return jpeg.Encode(e.w, img, &jpeg.EncoderOptions{
|
||||
Quality: 75,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user