[Python to C++] How do I get bitten by the for moon? Create a file name.

Asked 1 years ago, Updated 1 years ago, 87 views

If you squeeze Python, it looks like below

for i in range(0,10)
    CT_img = cv2.imread(r'D:\Remedi\Exercise\Xray\corrected images by CBCT/CBCT (' + str(i) + ').png', -1)

I'd like to change it to C++ as below and apply it I don't know how to bite i into the for door.

for (int i =0; i<10; i++)
{
    string num = to_string(i);
    string img_name = cout << "D:\Remedi\Exercise\Xray\corrected images by CBCT\" << num << "png" << endl;
    img_org = imread(img_name, IMREAD_GRAYSCALE);
}

I think we can look it up and try it with a cout, but I don't think so... C language grammar is hard "T" I'd appreciate your help.

python c++ matlab opencv

2022-09-21 12:38

1 Answers

Do I just combine strings and integers to make them into strings?

for (int i = 0 ; i < 10 ; i++){
    string img_name = "D:\Remedi\Exercise\Xray\corrected images by CBCT/CBCT (" + to_string(i) + ").png";
    imread(img_name, IMREAD_GRAYSCALE);
}

Wouldn't it be the stomach shape?


2022-09-21 12:38

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.