CodingTrain / CodingTrain/Suggestion-Box
Realtime Panorama using a webcam
- Langage dominant
- Aucune donnée de langage
- Étoiles
- 570
- Forks
- 85
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par le sketch Processing fourni et les trois exemples de panoramas liés ; comparez leur approche avec le code BoofCV de mise en correspondance de caractéristiques présenté ici. Documentez un tutoriel fonctionnel sur la création d’un panorama en temps réel à partir d’une webcam, avec du code exécutable et un résultat clair.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- computer-vision, documentation
- Type d'issue
- Documentation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100