My program takes partial filenames [closed]

asked 2019-06-02 18:44:42 -0600

Fmjohn gravatar image

I have a code and when I run it for all the images in a folder, it takes the partial file names.

if __name__ == "__main__":
data_catalog = "data"
raw_catalog = "raw_vessels"
vessel_catalog = "vessels_images"
files_names = [x for x in os.listdir(data_catalog) if os.path.isfile(os.path.join(data_catalog,x))]
#files_names.sort()

for file_name in files_names:
    out_name = file_name.split('.')[0]
    org_image = cv2.imread(data_catalog + '/' + file_name)
    raw_vessel, vessel_image = detect_vessel(org_image)
    cv2.imwrite(raw_catalog + '/' + out_name + ".JPG", raw_vessel)
    cv2.imwrite(vessel_catalog + '/' + out_name + ".JPG", vessel_image)

I am skipping description of "detect_vessel" part here. When I run this code, the output file in raw_vessel and vessel_image folder is seems to have a partial name compared to original filename. For example- the original file name is "moderate_1-20100106_152702_172.23.132.69_P09_CLIP_S_30921_36650_DES.mpg-0047.bmp" and the output is raw_vessel and vessel_image folder is "moderate_1-20100106_152702_172.JPG".

I cant figure out the problem. I have a lot images that start with same name with last part of images varrying. Please help me out.

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2019-06-02 23:56:03.430187

Comments

sorry, but this is not an opencv problem. (only a matter of coding skills, or the lack thereof)

berak gravatar imageberak ( 2019-06-02 23:58:04 -0600 )edit