Why do obj files read more vertices?

I use it meshlab.exe Open an obj file, or use Notepad to open an obj file. There are only 26408 vertices in it。
The obj file format is as follows (I removed the annotation symbol#):

Wavefront OBJ mtllib model.mtl 26408 vertices v -0.0495170839 0.7720808848 0.4657617399 v -0.0456603417 0.7741941402 0.4641847307 v -0.1665510523 0.7487052447 -0.0761576362 v 0.0980114390 0.7601768368 -0.0284780685 v 0.0954305225 0.7593402284 -0.0304180109 v 0.2112363794 0.7507016730 0.0587138140 v 0.2117039923 0.7513025276 0.0564567301 v 0.2442548111 0.7516214668 0.0573516367 v -0.1019155675 0.7483195137 -0.0658163599 v 0.3240373672 0.6416865419 -0.0256790367 v 0.2156865962 0.7512316044 0.0407874909 v 0.2910738839 0.7496361757 0.0008729120 v 0.2914005528 0.7498561777 -0.0001805026 v -0.1002491918 0.7556102703 0.0010426163 v -0.0954618129 0.7603561897 0.0031562183 v -0.0957103628 0.7601207650 0.0028731435 v 0.2860406632 0.7503417712 0.0227865344 v 0.2859714883 0.7505213540 0.0225769585 v -0.1583670350 0.7480347469 -0.1123186190 v -0.0569953775 0.7926299248 -0.0253003932 v -0.0781332995 0.7749295899 0.6390007532 v 0.1873167278 0.7809761373 0.6831041962 v 0.1824798420 0.7812302528 0.6822939733 v 0.0946332339 0.7807375689 0.6676606828 v 0.1271371529 0.7810844599 0.6730712102 v 0.0919379506 0.7801290763 0.6672108222 v 0.2039010933 0.7810425682 0.6858654135 v -0.2348067498 0.7754054320 0.6128682305 v -0.2638290460 0.7761159476 0.6080135198 ......

The code is as follows:

`

   auto reader =vtkSmartPointer<vtkOBJReader>::New();

reader->SetFileName(fileName.c_str());

reader->Update();

polyData = reader->GetOutput();

    std::cout << "There are " << polyData->GetNumberOfPoints() << " GetNumberOfPoints." << std::endl;

`

but the output is
There are 156909 GetNumberOfPoints.

How to make the number of points output with vtkobjreader as many as the number of vertices?

The OBJ reader may duplicate some vertices:

You may run vtkCleanPolyData to remove merge coincident points. If you need exact point ID correspondence then you may try to use another mesh file format (VTK, VTP, PLY, …).

Thank you very much!
You have solved my problem!

But can I ask you another problem?

My purpose is to downsample .obj file because there are too many points and faces in .obj files. So I import obj file with vtkOBJImporter, then use vtkCleanPolyData to reduce points, and then use vtkDecimatePro to reduce points and faces(I use 0.5 reduction). Finally, I use vtkOBJExporter to export obj file.

The texture effect of the exported obj file is poor. How can I make downsampling obj files with texture better?

original:

output:

DecimatePro results are usually not very nice. I mostly use quadric decimation instead.

I use the following code for down sampling, and then the error as shown in the figure below appears, and the figure after down sampling is as follows.

	vtkSmartPointer<vtkQuadricDecimation> decimate =
	vtkSmartPointer<vtkQuadricDecimation>::New();
decimate->SetInputData(pd);
decimate->AttributeErrorMetricOn();
decimate->SetTargetReduction(.5);
decimate->VolumePreservationOn();

decimate->Update();
vtkSmartPointer<vtkPolyData> decimated =
	vtkSmartPointer<vtkPolyData>::New();
decimated->ShallowCopy(decimate->GetOutput());

The complete code is as follows:

void Reduction(string fileNameObj, string fileNameMtl,
string fileNametexture, string exportFileName) {

/*fileNameObj = "F:\\AIData\\test1\\model1.obj";
fileNameMtl = "F:\\AIData\\test1\\model1.mtl";
fileNametexture = "F:\\AIData\\test1\\";*/

std::cout << "Reduction " << std::endl;
auto importer = vtkSmartPointer<vtkOBJImporter>::New();
importer->SetFileName(fileNameObj.c_str());
importer->SetFileNameMTL(fileNameMtl.c_str());
importer->SetTexturePath(fileNametexture.c_str());
auto backgroundRenderer = vtkSmartPointer<vtkRenderer>::New();
auto renderer = vtkSmartPointer<vtkRenderer>::New();
auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New();

renderWindow->AddRenderer(renderer);
renderWindow->SetSize(640, 480);
importer->SetRenderWindow(renderWindow);
importer->Update();
auto actors = renderer->GetActors();
actors->InitTraversal();
vtkActor* actor;
vtkPolyData* pd;
vtkPolyDataMapper* mapper;
for (vtkIdType a = 0; a < actors->GetNumberOfItems(); ++a)
{
	actor = actors->GetNextActor();
	if (actor->GetTexture())
	{
		//std::cout << "Has texture\n";
		actor->GetTexture()->InterpolateOn();
	}
	pd = dynamic_cast<vtkPolyData*>(actor->GetMapper()->GetInput());
}
std::cout << "Input cube has " << pd->GetNumberOfPoints()
	<< " vertices." << std::endl;

vtkSmartPointer<vtkCleanPolyData> cleanPolyData =
	vtkSmartPointer<vtkCleanPolyData>::New();
//cleanPolyData->SetInputConnection(cubeSource->GetOutputPort());
cleanPolyData->SetInputData(pd);
cleanPolyData->Update();

std::cout << "after cube has " << cleanPolyData->GetOutput()->GetNumberOfPoints()
	<< " vertices." << std::endl;

vtkSmartPointer<vtkQuadricDecimation> decimate =
	vtkSmartPointer<vtkQuadricDecimation>::New();
decimate->SetInputData(pd);
decimate->AttributeErrorMetricOn();
decimate->SetTargetReduction(.5);
decimate->VolumePreservationOn();

decimate->Update();
vtkSmartPointer<vtkPolyData> decimated =
	vtkSmartPointer<vtkPolyData>::New();
decimated->ShallowCopy(decimate->GetOutput());

//vtkSmartPointer<vtkDecimatePro> decimate =
//	vtkSmartPointer<vtkDecimatePro>::New();
//
//decimate->SetInputConnection(cleanPolyData->GetOutputPort());
//decimate->SetTargetReduction(0.5);
//decimate->PreserveTopologyOn();
//decimate->Update();



vtkSmartPointer<vtkPolyDataMapper> decimatedMapper =
	vtkSmartPointer<vtkPolyDataMapper>::New();

decimatedMapper->SetInputData(decimated);

vtkSmartPointer<vtkActor> decimatedActor =
	vtkSmartPointer<vtkActor>::New();
decimatedActor->SetMapper(decimatedMapper);
//renderer->AddActor(actor);


renderer->RemoveActor(actor);
renderer->AddActor(decimatedActor);
renderWindow->AddRenderer(renderer);

auto exporter = vtkSmartPointer<vtkOBJExporter>::New();
exporter->SetActiveRenderer(renderer);
exporter->SetRenderWindow(renderWindow);

exporter->SetFilePrefix(exportFileName.c_str());

std::cout << "Writing " << exportFileName << std::endl;
exporter->Write();
std::cout << "success " << std::endl;

}

The complete OBJ files is as follows(

Because the original obj file is too large, What I uploaded is an obj file which has been simplified with wrap software. The effect after the simplification of wrap software is what I want.):
model1.mtl (436 Bytes)

Those errors logged by vtkQuadricDecimation are usually harmless. However, I’m not sure that the class is prepared to process texture data.

If you upload the full file somewhere and post the link here then maybe someone who has experience with texture-mapped surfaces can have a look at it (I don’t know that part of VTK well, so I won’t be able to investigate).