473,802 Members | 1,984 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

list iterator not incremntable in c++: debug assertion

2 New Member
Hi guyz,

i am new to c++ programming..an d this forum ...i just hope that i am giving you all the information which will enable you to figure out the problem.

My program uses c++ and image processing toolbox "imagemagick".T his program ideally should work on multiple images and gives me the centroids of white/colored dots present in the images. It does this by initially finding out regons that form a dot.It checks for regions whose pixels are white in color. the mask that it uses for doing it is a square window.Another interesting point is when I change either the window size or the threshold. it works for certain combinations.Th reshold is the value that determines whether the pixel is white or balck.



QUERY: when i run my program on multiple images, it gives an error dialogue that
DEBUG ASSERTION FALIED
list operator not incrementable



the lines causing the error:
Expand|Select|Wrap|Line Numbers
  1. for (pointIter = dotList.begin(); pointIter != dotList.end(); pointIter++)
  2. for (regionIter = regionList.begin(); regionIter != regionList.end(); regionIter++)
  3. { // Handle left/right
  4. if (((regionIter->x == (pointIter->x + nWindowSize)) || (regionIter->x == (pointIter->x - nWindowSize)) && (regionIter->y == pointIter->y))) 
  5. { dotList.push_back(*regionIter);
  6. regionIter = regionList.erase(regionIter);
  7. }
  8.  
  9. if(regionIter==regionList.end())
  10. {
  11. break;
  12. /*Do nothing*/
  13. }
  14. // Handle up/down
  15. else if (((regionIter->y == (pointIter->y + nWindowSize)) || (regionIter->y == (pointIter->y - nWindowSize))) && (regionIter->x == pointIter->x)) 
  16. { dotList.push_back(*regionIter);
  17. regionIter = regionList.erase(regionIter);
  18. }
  19.  
  20. }
  21. }
Oct 2 '07 #1
1 2375
Savage
1,764 Recognized Expert Top Contributor
Hi guyz,

i am new to c++ programming..an d this forum ...i just hope that i am giving you all the information which will enable you to figure out the problem.

My program uses c++ and image processing toolbox "imagemagick".T his program ideally should work on multiple images and gives me the centroids of white/colored dots present in the images. It does this by initially finding out regons that form a dot.It checks for regions whose pixels are white in color. the mask that it uses for doing it is a square window.Another interesting point is when I change either the window size or the threshold. it works for certain combinations.Th reshold is the value that determines whether the pixel is white or balck.



QUERY: when i run my program on multiple images, it gives an error dialogue that
DEBUG ASSERTION FALIED
list operator not incrementable



the lines causing the error:
Expand|Select|Wrap|Line Numbers
  1. for (pointIter = dotList.begin(); pointIter != dotList.end(); pointIter++)
  2.   for (regionIter = regionList.begin(); regionIter != regionList.end(); regionIter++)
  3.   {  
  4.        // Handle left/right
  5.       if (((regionIter->x == (pointIter->x + nWindowSize)) || (regionIter->x ==   
  6.                     (pointIter->x - nWindowSize)) && (regionIter->y == pointIter->y))) 
  7.       {
  8.             dotList.push_back(*regionIter);
  9.             regionIter = regionList.erase(regionIter);
  10.      }
  11.  
  12.      if(regionIter==regionList.end())
  13.     {
  14.            break;
  15.           /*Do nothing*/
  16.     }
  17.     // Handle up/down
  18.      else if (((regionIter->y == (pointIter->y + nWindowSize)) || (regionIter->y ==                      
  19.                      (pointIter->y - nWindowSize))) && (regionIter->x == pointIter->x)) 
  20.      {
  21.            dotList.push_back(*regionIter);
  22.            regionIter = regionList.erase(regionIter);
  23.     }
  24.  
  25.   }
  26. }
Have you tried with preincrementati on?

Savage
Oct 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
10955
by: Brett L. Moore | last post by:
Hi, I have had trouble determining whether the STL list.size() operation is O(1) or O(n). I know the list is a doubly-linked list, so if the size() operation begins at the head, then counts to the end - obviously its O(n). However, keeping track of inserts and deletes isn't that tough, so its conceivable (to me!) that size() could be O(1). For my application, the lists can be quite long (millions of elements), so the answer greatly...
1
3549
by: Eyal | last post by:
Hi, We have an issue with Debug Assertion showing in Release builds in Managed C++! I have created a small managed C++ project that looks like this: #include "stdafx.h" #using <mscorlib.dll> #using <System.dll> using namespace System; int _tmain()
8
16953
by: freckred76 | last post by:
Hi, I think this might be a VC++ problem. I am using Microsoft Visual Studio 2005 Full Version (8.0). I have a simple for loop that iterates over a list using the standard iterator. The list is populated with a struct _BLOCK defined as: typedef struct {
4
6379
by: Johan Pettersson | last post by:
Hi, I'm trying to "port" a project from VC++ 2003 to VC++ 2005 (Express Edition). This project contains the following code on several places (It is not exactly this code but a generalization of what it does.): vector<int> int_vector; vector<int>::iterator i, j; for (i = int_vector.begin (); i != int_vector.end (); i++)
4
9425
by: Mullai | last post by:
Hi , My program gives an error message like this Debug Assertion Failed! program:................ File: wincore.cpp Line: 958 Please can anyone help me out in this issue. I have to solve this bug immediately in my project.
12
4553
by: xgngli | last post by:
Suppose we have a vector: vector<intvec(10); We can declare a iterator this way: vector<int>::iterator vecItor; and then dereference it like this: for (vecItor = vec.begin(); vecItor != vec.end(); vecItor++) { cout << *vecItor << endl;
27
2772
by: Jason Doucette | last post by:
I'm getting an assertion fire from a list iterator being checked against NULL. This did not occur in VC++ 2003 (v7.1). Are there changes that have been made to the STL between these versions that I should know about? Any resources I should check into? thanks, Jason
11
7090
by: beginner | last post by:
Hi, Does anyone know how to put an assertion in list comprehension? I have the following list comprehension, but I want to use an assertion to check the contents of rec_stdl. I ended up using another loop which essentially duplicates the functions of list comprehension. It just look like a waste of coding and computer time to me. I just wish I could put the assertions into list comprehensions.
1
1645
by: ashishbhatt12 | last post by:
Hi All, I am using list class in my project(MFC Application). I have made list like ..... typedef std::list rectlist; // Here list is of type RECT in one header file. And during my project execution I am storing rectangles in the list. And now,When I use list iterator in another class like below....( I have already included its header file in using class)
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10538
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...
1
10285
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
10063
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9115
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...
0
6838
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
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2966
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.