Is it a bug?

If you are allergic to bug trackers, you can post here any remarks, issues and potential bugs you encounter
Post Reply
yjf27281181
Posts: 16
Joined: Mon Sep 26, 2016 12:46 am

Is it a bug?

Post by yjf27281181 »

Hi denial, I met a very strange problem.
What I want to do is to change the visibility of each cloudpoints according its classification. But if I try to change the visibility of cloudpoint whose classification is 1(I think 1 represent Vegetation), then those cloudpoints whose classification is 2(Groud) would change their classifications to 1.

It is defficult to me to describe this phenomenon, and I am not sure whether you have understood my situation, so I would show you some pictures to explain my problem.

Image
this is original situation, and after I run those codes, a strange thing would happen.

Code: Select all

	CCLib::ScalarField* pClassification = cloud->getScalarField(0); 
	ccGenericPointCloud::VisibilityTableType* visibilityArray = cloud->getTheVisibilityArray();
	unsigned cloudSize = cloud->size();
	for (int i = 0; i < static_cast<int>(cloudSize); ++i)
	{
		int state = pClassification->getValue(i);
		if (1 == state) {
			visibilityArray->setValue(i, POINT_HIDDEN);
		}
	}
Here is what happened.
Image

So what I expect is those blue points should dispear. However the fact is those blue point become green and some points dispear, which is totally werid to me. What's more, if I change the number "1" to other numbers like "2" or "6", it would let those points whose classification is "2"(or "6") dispear.

I am sure there is no any codes trying to change the classification of cloudpoints. So how to solve this bug?
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Is it a bug?

Post by daniel »

Have you called 'resetVisibilityArray' at the beginning?

And then, are you simply hiding those points (leaving the visibility array enabled) or are you creating a new cloud from this selection? In the second case, then first you shouldn't use the visiblity array mechanism for this (it's simpler / faster to use a ReferenceCloud and ccPointCloud::partialClone), then mind that the color scale is 'relative' by default and automatically spans between the minimum and maximum scalar values. If you remove the lowest value for instance, then all colors will change.

Don't hesitate to send me the file if you need more precise information (cloudcompare [at] danielgm.net).
Daniel, CloudCompare admin
yjf27281181
Posts: 16
Joined: Mon Sep 26, 2016 12:46 am

Re: Is it a bug?

Post by yjf27281181 »

Thanks for your response.
I have thought this problem for nearly 5 hours, then I know the reason and wondering why I am so stuipd...

the answear is there are 2 lays in the picture, the blue one is above the green one, so after blue layer dispears, we can see those green points. But at the begining I thought those green points appeared because the blue points became green....that's my fault.
Post Reply