Skip to content

Commit

Permalink
update readme. Switch version to next snapshot.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Carroll committed Jul 24, 2022
1 parent 463700d commit 5c081b5
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 18 deletions.
71 changes: 68 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,73 @@ This project will provide a basis for building video processing chains meant for

Most dependencies will be picked up automatically from [maven central](https://www.mvnrepository.com/) but there are several to take note of.

1. [pilecv4j-opencv-packaging](https://github.com/KognitionAI/pilecv4j-opencv-packaging) which contains scripts for building an packaging [OpenCV](https://opencv.org/) for use with these libraries. These projects read the native shared libraries out of packaged Jar files. [pilecv4j-opencv-packaging](https://github.com/KognitionAI/pilecv4j-opencv-packaging) will build and package [OpenCV](https://opencv.org/) itself into a jar file.
1. [dempsy-commons](https://github.com/Dempsy/dempsy-commons) is normally deployed to maven central but will occasionally (like at the time of this writing) have changes required by the projects here. Currently, to build the `master` branch of this project you will also need to build the `master` branch of [dempsy-commons](https://github.com/Dempsy/dempsy-commons).
1. [FFMpeg](https://ffmpeg.org/) which probably needs no introduction if you're on this page.
1. [Python](https://www.python.org/). In this case you'll need the development libraries installed.
1. [Python](https://www.python.org/). In this case you'll need the development libraries installed for Python3

## Jumping right in

Here is a simple example to get started. We'll write java code that plays a video and does some minimal manupulaiton. To use the video processing include the folloing in your project (or the gradle equivalent).

``` xml
<dependency>
<groupId>ai.kognition.pilecv4j</groupId>
<artifactId>lib-ffmpeg</artifactId>
<version>0.16</version>
</dependency>
```

We'll need a video file to work with. If you need one you can use the `.mp4` from here: https://github.com/leandromoreira/ffmpeg-libav-tutorial/blob/master/small_bunny_1080p_60fps.mp4

For the purposes of the tutorial we'll assume there's a file at `/tmp/test-video.mp4`.

The following is a simple example that will play display the video to a window (note, there is no audio processing in the library).

``` java
// Most components are java resources (Closeables)
try(

// We will create an ImageDisplay in order to show the frames from the video
ImageDisplay window = new ImageDisplay.Builder().windowName("Tutorial 1").build();

// Create a StreamContext using Ffmpeg2. StreamContexts represent
// a source of media data and a set of processing to be done on that data.
final StreamContext sctx = Ffmpeg2.createStreamContext()

// Create a media data source for the StreamContext. In this case the source
// of media data will be our file.
.createMediaDataSource("file:///tmp/test-video.mp4")

// We need to open a processing chain. A processing chain is a
// grouping of a stream selector, with a series of media stream
// processors.
.openChain()

// We are simply going to pick the first video stream from the file.
.createFirstVideoStreamSelector()

// Then we can add a processor. In this case we want the system to call us
// with each subsequent frame as an OpenCV Mat.
.createVideoFrameProcessor(videoFrame -> {

// We want to display each frame. PileCV4J extends the OpenCV Mat functionality
// for better native resource/memory management. So we can use a try-with-resource.
try(CvMat mat = videoFrame.bgr(false);) { // Note, we want to make sure the Mat is BGR
// Display the image.
window.update(mat);
}

})

// We need the resulting streaming context returned.
.streamContext();

) {

// play the media stream.
sctx.play();
}
```


## Project Overview

Expand Down Expand Up @@ -78,6 +141,8 @@ You probably don't need to worry about `lib-util`. `lib-util` is a library with

This is a bit of an oddity but it's basically an abstraction for object tracking in video with several OpenCv implementations.

##

## Building

See [Prerequisites](#Prerequisites) and make sure they're all installed.
Expand Down
2 changes: 1 addition & 1 deletion docker-nginx-rtmp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>pilecv4j-parent</artifactId>
<groupId>ai.kognition.pilecv4j</groupId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
</parent>
<artifactId>docker-nginx-rtmp</artifactId>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion lib-ffmpeg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pilecv4j-parent</artifactId>
<groupId>ai.kognition.pilecv4j</groupId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
</parent>
<artifactId>lib-ffmpeg</artifactId>
<name>lib-ffmpeg (${project.version})</name>
Expand Down
2 changes: 1 addition & 1 deletion lib-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pilecv4j-parent</artifactId>
<groupId>ai.kognition.pilecv4j</groupId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
</parent>
<artifactId>lib-image</artifactId>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion lib-nr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pilecv4j-parent</artifactId>
<groupId>ai.kognition.pilecv4j</groupId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
</parent>
<artifactId>lib-nr</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion lib-python/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pilecv4j-parent</artifactId>
<groupId>ai.kognition.pilecv4j</groupId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
</parent>

<artifactId>lib-python</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion lib-tf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pilecv4j-parent</artifactId>
<groupId>ai.kognition.pilecv4j</groupId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
</parent>
<artifactId>lib-tf</artifactId>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion lib-tracking/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pilecv4j-parent</artifactId>
<groupId>ai.kognition.pilecv4j</groupId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lib-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pilecv4j-parent</artifactId>
<groupId>ai.kognition.pilecv4j</groupId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
</parent>
<artifactId>lib-util</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion native-ffmpeg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>ai.kognition.pilecv4j</groupId>
<artifactId>pilecv4j-parent</artifactId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
</parent>

<artifactId>native-ffmpeg</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion native-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>pilecv4j-parent</artifactId>
<groupId>ai.kognition.pilecv4j</groupId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
</parent>

<artifactId>native-image</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion native-nr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>pilecv4j-parent</artifactId>
<groupId>ai.kognition.pilecv4j</groupId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
</parent>

<artifactId>native-nr</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion native-python/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>pilecv4j-parent</artifactId>
<groupId>ai.kognition.pilecv4j</groupId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
</parent>

<artifactId>native-python</artifactId>
Expand Down
4 changes: 1 addition & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<groupId>ai.kognition.pilecv4j</groupId>
<version>0.16</version>
<version>0.17-SNAPSHOT</version>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<artifactId>pilecv4j-parent</artifactId>
Expand Down Expand Up @@ -46,8 +46,6 @@

<commons.cli.version>1.4</commons.cli.version>
<tiff-java.version>2.0.1</tiff-java.version>

<docker-compose-junit.version>1.5.0</docker-compose-junit.version>
</properties>

<url>[email protected]:KognitionAI/pilecv4j</url>
Expand Down

0 comments on commit 5c081b5

Please sign in to comment.