Comments (2)
I've implemented cvRelabel and it works well for me:
void cvRelabel(CvBlobs blobs, IplImage* imgLabel) {
int i=1;
int stepLbl = imgLabel->widthStep/(imgLabel->depth/8);
for (CvBlobs::const_iterator it=blobs.begin(); it!=blobs.end(); ++it, i++) {
CvBlob* blob = it->second;
if(blob->label != i) {
for(int y=0; y<imgLabel->height; y++ ) {
CvLabel *label = (CvLabel *) imgLabel->imageData + y * stepLbl;
for(int x=0; x<imgLabel->width; x++) {
if(*label == blob->label) {
*label = i;
}
label++;
}
}
blob->label = i;
}
}
}
Original comment by [email protected]
on 12 Jan 2011 at 11:11
from cvblob.
Hi Pablo,
CvBlobs is not a `vector` but a `map`. This way the "indexes" don't change when
you filter blobs. I used maps for that reason. For example, you have:
blobs[0], blobs[1], blobs[2], blobs[3]
After filter you could have:
blobs[1], blobs[3]
Of course, if you use iterators you'll see that the "first" blobs has
`label=1`, and next blob has `label=3`, but their indexes are the same. If you
need to know the "index" of a iterator you can use `it->first`, but it should
be the equal to `it->second->label`.
So, do a relabel or something like that seems unnecessary to me :-S Can you
overcome the problem in any other way?
I could refactor all the library and use only vector instead of maps (vector
must be more efficient), but I find maps easier when you program.
Regards,
Cristóbal
Original comment by [email protected]
on 13 Jan 2011 at 9:57
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
from cvblob.
Related Issues (20)
- Problem with signed char, cvLabel hangs HOT 10
- Cannot display largest blob
- Object boundry Detection HOT 1
- error when i use cvblob python swig interface in ubuntu opencv test.py HOT 2
- usage of memory never stop increasing with cvblob python libfreenect HOT 1
- Compile please for Windows XP VS2008 HOT 1
- small copy paste error in cvLabel.cpp HOT 1
- Patch for /trunk/cvBlob/cvblob.h
- cvb::cvReleaseBlobs(blobs); cause to crash when using -std=c++0x for project HOT 1
- Ubuntu package
- Properties of blob HOT 1
- LINK : fatal error LNK1104: cannot open file '..\lib\Debug\cvblob.lib' on windows platform! HOT 3
- cvReleaseBlobs (EXC_BAD_ACCESS) HOT 1
- C++ Version of cvblob? HOT 2
- bug - rendering
- CMake include path misinterpreted if it has a space in it
- Bug in cvSetImageROItoBlob HOT 1
- label image widthstep incorrect
- cvblob Running error
- CvBlob Contour into default OpenCv Contour
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cvblob.