CodingTrain / CodingTrain/Suggestion-Box

Realtime Panorama using a webcam

Offen
#439 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Keine Sprachdaten
Sterne
570
Forks
85
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

My suggestion is to make a tutorial showing how to make a realtime panorama with a camera.
Searching on web, a few people have done it but they not show the code .
I tried to make it, but without success ='(

```
import boofcv.processing.*;
import boofcv.struct.image.*;
import boofcv.struct.feature.*;
import georegression.struct.point.*;
import java.util.*;
import processing.video.*;

Capture video;

PImage prevFrame;
PImage current;

int leu = 0;
int c = 1;
float avgX = 0;
float avgY = 0;

List locations0, locations1; // feature locations
List matches; // which features are matched together

void setup() {

size(600, 240);
video = new Capture(this, 320, 240, 30);
video.start();

prevFrame = createImage(video.width, video.height, RGB);
current = createImage(video.width, video.height, RGB);
}
void detectar() {
SimpleDetectDescribePoint ddp = Boof.detectSurf(true, ImageDataType.F32); //usar SURF
SimpleAssociateDescription assoc = Boof.associateGreedy(ddp, true); // busca interminavel

// Find the features
ddp.process(prevFrame);
locations0 = ddp.getLocations();
List descs0 = ddp.getDescriptions();

ddp.process(current);
locations1 = ddp.getLocations();
List descs1 = ddp.getDescriptions();

// associar os pontos
assoc.associate(descs0, descs1);
matches = assoc.getMatches();
}

void draw() {

loadPixels();
video.loadPixels();
prevFrame.loadPixels();

detectar();
int count = 0;
for ( AssociatedIndex i : matches ) {
if ( count++ % 20 != 0 )
continue;
else if ( count > 100)
{
break;
}

Point2D_F64 p0 = locations0.get(i.src);
Point2D_F64 p1 = locations1.get(i.dst);
float diferencaX = abs((float) p0.x - (float)p1.x);
float diferencaY = abs((float) p0.y - (float)p1.y);

if (leu < 30) {

if (diferencaY < 15) {
avgX = avgX + (diferencaX - avgX)/c;
avgY = avgY + (diferencaY - avgY)/c;
c++;
println(c);
}
}

if ( leu == 29) {
println("oi");
if (avgX > 300) {
translacao();
}
}
leu++;
}
}

void translacao() {
image( prevFrame, 0, 0 );
image( current, avgX, -avgY);
updatePixels();
println(avgX);
c = leu = 0;
avgX = avgY = 0;
}

void captureEvent(Capture video) {
// Save previous frame for motion detection!!
// Before we read the new frame, we always save the previous frame for comparison!
if (avgX > 300) {
prevFrame.copy(video, 0, 0, video.width, video.height, 0, 0, video.width, video.height);
prevFrame.updatePixels(); // Read image from the camera
}
video.read();
current.copy(video, 0, 0, video.width, video.height, 0, 0, video.width, video.height);
current.updatePixels();
}

```

Here are some examples:

https://www.youtube.com/watch?v=QapSxGnUWtY&t
https://www.youtube.com/watch?v=434zw201iN8
https://www.youtube.com/watch?v=rXcupvutRMs

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start with the supplied Processing sketch and the three linked panorama examples; compare their approach with the BoofCV feature-matching code shown here. Document a working realtime webcam panorama tutorial with runnable code and a clear result.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
computer-vision, documentation
Issue-Typ
Dokumentation
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.