473,774 Members | 2,275 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image sequence listing ...

Am not sure if it's been asked before (did a search but didn't come up
with anything
related...).
I'm trying to write some code to "collapse" image sequences into
a single item , i.e.:
image.1.exr
image.2.exr
....
image.100.exr

into
image.[1-100].exr

This is for display only so i do not show up 100 files but only one
as some file managers do.

Anyone got any info on doing this quickly ?

I use Boost already in my app, so I guess the regex boost lib could
help
but not really sure of the most efficient way of doing it
Dec 20 '07 #1
5 2163
ma*********@gma il.com wrote:
Am not sure if it's been asked before (did a search but didn't come up
with anything
related...).
I'm trying to write some code to "collapse" image sequences into
a single item , i.e.:
image.1.exr
image.2.exr
...
image.100.exr

into
image.[1-100].exr

This is for display only so i do not show up 100 files but only one
as some file managers do.

Anyone got any info on doing this quickly ?
What's your C++ language question? Are you trying to declare an array
to help you manage the sequence? You can also do it using 'std::map'
or 'std::vector', but I am unsure what to recommend since you didn't
show any code, and C++ doesn't have a definition of "image", nor does
it have a definition of "collapsing " of those.
I use Boost already in my app, so I guess the regex boost lib could
help
but not really sure of the most efficient way of doing it
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Dec 20 '07 #2
On Dec 20, 12:43 pm, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
majestik...@gma il.com wrote:
Am not sure if it's been asked before (did a search but didn't come up
with anything
related...).
I'm trying to write some code to "collapse" image sequences into
a single item , i.e.:
image.1.exr
image.2.exr
...
image.100.exr
into
image.[1-100].exr
This is for display only so i do not show up 100 files but only one
as some file managers do.
Anyone got any info on doing this quickly ?

What's your C++ language question? Are you trying to declare an array
to help you manage the sequence? You can also do it using 'std::map'
or 'std::vector', but I am unsure what to recommend since you didn't
show any code, and C++ doesn't have a definition of "image", nor does
it have a definition of "collapsing " of those.
I use Boost already in my app, so I guess the regex boost lib could
help
but not really sure of the most efficient way of doing it

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Well I guess my c++ question is about
how do you list a folder, and while doing that
collapsing the filenames that are in the form prefix.%d.suffi x
into "groups" like prefix.[first-last].suffix
it's not image related really, just about how to work out
the strings to collapes into one.
Dec 20 '07 #3
ma*********@gma il.com wrote:
[..]
Well I guess my c++ question is about
how do you list a folder, and while doing that
collapsing the filenames that are in the form prefix.%d.suffi x
into "groups" like prefix.[first-last].suffix
it's not image related really, just about how to work out
the strings to collapes into one.
Ah... OK. Folders aside, files aside, your question is what you
should do to form "blah.[N-M].blah" if you have a bunch of strings
all containing "blah.<N>.blah" , "blah.<N+1>.bla h", etc., until the
"blah.<M>.b lah" where N and M are two numbers. Right?

This is not a C++ language question. It's an algorithm question.
You need an algorithm for string processing. I would probably
suggest something like

// find the beginning of the sequence
int N;
for (N = 0; N < INT_MAX; ++N) {
std::ostringstr eam os;
os << "prefix." << N << ".suffix";
std::string filename(os.str ());
if (/* exists the file with pattern 'filename' */)
break;
}
// now N is your start
int M;
for (int M = N; M<INT_MAX; ++M) {
std::ostringstr eam os;
os << "prefix." << M << ".suffix";
std::string filenam(os.str( ));
if (/* does NOT exist file with pattern 'filename' */)
break;
}
if (--M N) { // got the sequence!
std::ostringstr eam os;
os << "prefix.[" << N << '-' << M << "].suffix";
return os.str(); // here you go
}
else { // it's a single file, maybe.
...
}

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Dec 20 '07 #4
On Dec 20, 1:27 pm, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
majestik...@gma il.com wrote:
[..]
Well I guess my c++ question is about
how do you list a folder, and while doing that
collapsing the filenames that are in the form prefix.%d.suffi x
into "groups" like prefix.[first-last].suffix
it's not image related really, just about how to work out
the strings to collapes into one.

Ah... OK. Folders aside, files aside, your question is what you
should do to form "blah.[N-M].blah" if you have a bunch of strings
all containing "blah.<N>.blah" , "blah.<N+1>.bla h", etc., until the
"blah.<M>.b lah" where N and M are two numbers. Right?

This is not a C++ language question. It's an algorithm question.
You need an algorithm for string processing. I would probably
suggest something like

// find the beginning of the sequence
int N;
for (N = 0; N < INT_MAX; ++N) {
std::ostringstr eam os;
os << "prefix." << N << ".suffix";
std::string filename(os.str ());
if (/* exists the file with pattern 'filename' */)
break;
}
// now N is your start
int M;
for (int M = N; M<INT_MAX; ++M) {
std::ostringstr eam os;
os << "prefix." << M << ".suffix";
std::string filenam(os.str( ));
if (/* does NOT exist file with pattern 'filename' */)
break;
}
if (--M N) { // got the sequence!
std::ostringstr eam os;
os << "prefix.[" << N << '-' << M << "].suffix";
return os.str(); // here you go
}
else { // it's a single file, maybe.
...
}

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
well yes it's the problem, but the initial conditions are a bit
different
let's say i have a list of strings in the form you mentioned
prefix.<N>.suff ix, I can have different prefixes etc.
but I guess I cannot avoid going through the files one by one
and looking if i can join it with other files in the same folder.
Dec 20 '07 #5
ma*********@gma il.com wrote:
On Dec 20, 1:27 pm, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
>majestik...@gm ail.com wrote:
>>[..]
Well I guess my c++ question is about
how do you list a folder, and while doing that
collapsing the filenames that are in the form prefix.%d.suffi x
into "groups" like prefix.[first-last].suffix
it's not image related really, just about how to work out
the strings to collapes into one.

Ah... OK. Folders aside, files aside, your question is what you
should do to form "blah.[N-M].blah" if you have a bunch of strings
all containing "blah.<N>.blah" , "blah.<N+1>.bla h", etc., until the
"blah.<M>.blah " where N and M are two numbers. Right?

This is not a C++ language question. It's an algorithm question.
You need an algorithm for string processing. I would probably
suggest something like

// find the beginning of the sequence
int N;
for (N = 0; N < INT_MAX; ++N) {
std::ostringstr eam os;
os << "prefix." << N << ".suffix";
std::string filename(os.str ());
if (/* exists the file with pattern 'filename' */)
break;
}
// now N is your start
int M;
for (int M = N; M<INT_MAX; ++M) {
std::ostringstr eam os;
os << "prefix." << M << ".suffix";
std::string filenam(os.str( ));
if (/* does NOT exist file with pattern 'filename' */)
break;
}
if (--M N) { // got the sequence!
std::ostringstr eam os;
os << "prefix.[" << N << '-' << M << "].suffix";
return os.str(); // here you go
}
else { // it's a single file, maybe.
...
}

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask

well yes it's the problem, but the initial conditions are a bit
different
let's say i have a list of strings in the form you mentioned
prefix.<N>.suff ix, I can have different prefixes etc.
but I guess I cannot avoid going through the files one by one
and looking if i can join it with other files in the same folder.
It's all in how you check for the existence of the file. If your
system allows enumerating with a pattern (like "*.1001.img "), then
you're in luck and you need to put the asterisk instead of 'prefix'.

The algorithm as I wrote it is also substandard from the performance
point of view. It would be nice if you could simply get all the
strings (names of the files) fitting the pattern "*.[0-9]+.suffix",
and sort them while disregarding the prefix (you need a custom
comparison functor for that). Then you simply have an array of
strings, and the very first one contains your N, which you can
simply extract from the string itself. And you can simply keep
extracting the number from each string and compare it to what you
expect (previous + 1). If it isn't, your sequence is over, and
you may need to start another sequence...

Anyway, this doesn't seem to be a C++ topic either. Try posting to
comp.programmin g, the general algorithm discussion newsgroup.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Dec 20 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6166
by: Randell D. | last post by:
Folks, I'm still learning javascript - I've invested in a couple of books and reading online as much as possible. I'm pretty sure what I am suggesting is possible though I'm trying to weigh up the faults that might go with the suggestion... all opinions welcome. My question: I have a list of links that go to pages that have a similar layout. Could I have a text swap, similar to what I've seen with image swaps (or an image switch)...
13
4572
by: lkrubner | last post by:
Suppose I need to get an image as a stream of bytes. I want to store this in a variable and then embed it in some Postscript code. In my Postscript code, the image might look like this: {< ffffffffffffffffffffffffffffffffffffffffffffffffffff ff000000000000000000000000000000000000ffffffffffffff ff00efefefefefefefefefefefefefefefef0000ffffffffffff ff00efefefefefefefefefefefefefefefef00ce00ffffffffff
5
2390
by: Camet | last post by:
I have been trying to create a dynamic id for a number of images in a table so that I can identify which image was clicked on later. ie I need to set a variable to the id of each image, that is generated by a loop. The info is read from an XML file in another function and each section of info is stored as a separate object; Each object is pertaining to one row in the table. function createTable () { var output, dynamId;
11
1433
by: Richard | last post by:
All I want to do is to read a list of the image files in my folder and display them on a page. That way I don't have to re-write the page, I can just upload extra images. I don't need fancy bells or whistles or slide shows or sliders or anything. The smallest google search I come up with offers a million pages, most of them bells and whistle types and I can't find the wood for the trees.
6
7612
by: Frank Rizzo | last post by:
I have an interesting problem. I have a directory of image files. However, none of the files have an extension. I need to figure out what type if image it is and attach an extension to the file. Is there a way to determine image type in the .net framework? Thanks.
1
1948
by: oruccim | last post by:
hi I want understanding pictures colorfull for examle colorfull or black-white image.google.com there are understand it .Can I understand it thanks....
20
13519
realin
by: realin | last post by:
hiya guys, I have a question, i want to display the image which is above the page, while my script loads in the background. This is a simple script which check for new messages in my mailbox, so it is more like GMAIL's loading bar which is shown just before we land into our mailboxes. Guys, how do i do it ? Because i have tried ob_start and ob_end_flush, but with no luck i am unable to see the image before script terminates. The whole...
7
3733
by: dragiton | last post by:
SA Upload SQL Database variable types (image upload and storage) I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to rebuild. Does anyone have any suggestions on what I may have wrong. I am not sure if I built my table to store the picture id's correctly. Maybe a field type or something. <form name="UpdatePropertyPicture" method="POST"...
2
4095
by: studentofknowledge | last post by:
For some unknown reason ie is placing images I have in a div in a weird way. One image is overlapping another but this problem is not occuring in mozilla. I have looked at my code over and over again but cant seem to find out what the problem is. I think this could be fixed with a i.e hack??? please advise the problem of the overlapping image is occuring in imagerow2 div on line 56. please see my code below here is my html <!DOCTYPE...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.