From jni.soma at gmail.com Tue May 2 08:48:54 2017 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Tue, 2 May 2017 22:48:54 +1000 Subject: [scikit-image] Using EllipseModel In-Reply-To: <1493408394.1910667.959749680.43B38704@webmail.messagingengine.com> References: <1493408394.1910667.959749680.43B38704@webmail.messagingengine.com> Message-ID: <7627dce9-cebb-402b-a5ca-98bc2d925771@Spark> I?ve raised the issue: https://github.com/scikit-image/scikit-image/issues/2646 On 29 Apr 2017, 5:40 AM +1000, Stefan van der Walt , wrote: > It may well be that those two functions use opposite directions for theta.? Do you mind filing an issue? > > Thanks > St?fan > > On Fri, Apr 28, 2017, at 11:02, Surya Kasturi wrote: > > Hi, > > > > I?m trying to use skimage.measure.EllipseModel to estimate an ellipse around a contour. The results seems to be not so satisfying. I am wondering if I am using ?orientation? parameter correctly. > > > > Could anyone please let me know whether ?theta? is in radians or degrees? / I am doing anything wrong? > > > > from skimage.measure import EllipseModel > > > > # create ellipse model > > ellipse = EllipseModel() > > ellipse.estimate(cnt) > > > > xc, yc, a, b, theta = np.array(ellipse.params, dtype=int) > > > > # find perimeter > > rr, cc = draw.ellipse_perimeter(xc, yc, a, b, orientation=theta) > > > > # plot > > ax.scatter(cc, rr, s=5, label="EllipseModel?) > > > > > > > > > > > > Thank you, > > Surya > > > > _______________________________________________ > > scikit-image mailing list > > scikit-image at python.org > > https://mail.python.org/mailman/listinfo/scikit-image > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: plt.png Type: image/png Size: 56396 bytes Desc: not available URL: From jni.soma at gmail.com Tue May 2 09:12:40 2017 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Tue, 2 May 2017 23:12:40 +1000 Subject: [scikit-image] Segmentation In-Reply-To: References: Message-ID: <32cc51df-b168-4362-93c2-6e118001fa70@Spark> Yes, as you say and as suggested by Brian, I think using the background from the watershed would be the proper way. You could also find the mean intensity of each label and set to background those with a mean intensity below some threshold. The ndimage.labeled_comprehension function should be able to do this: https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.labeled_comprehension.html#scipy-ndimage-labeled-comprehension as well as our own regionprops. On 26 Apr 2017, 8:01 AM +1000, Cedric Espenel , wrote: > Hi, > > Sorry, I guess I can just mask the result with the watershed segmentation. I guess I wonder if it is the proper way to do it? And also, from your point of view, if it's the way to go to segment these cells or if you think of a better way? > > Cedric > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image -------------- next part -------------- An HTML attachment was scrubbed... URL: From jni.soma at gmail.com Tue May 2 09:55:06 2017 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Tue, 2 May 2017 23:55:06 +1000 Subject: [scikit-image] Making glare free photo scans Message-ID: Hi everyone, I recently saw this blog post from Google and was struck by how easily it could map to scikit-image functions. If anyone wants to make a blog post / gallery example, it would be most welcome. ;) https://research.googleblog.com/2017/04/photoscan-taking-glare-free-pictures-of.html Juan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From suryak at udel.edu Tue May 2 10:10:44 2017 From: suryak at udel.edu (Surya Kasturi) Date: Tue, 2 May 2017 10:10:44 -0400 Subject: [scikit-image] Using EllipseModel In-Reply-To: <7627dce9-cebb-402b-a5ca-98bc2d925771@Spark> References: <1493408394.1910667.959749680.43B38704@webmail.messagingengine.com> <7627dce9-cebb-402b-a5ca-98bc2d925771@Spark> Message-ID: <7374BB0C-38CD-47FE-8196-8A3170E53DBB@udel.edu> Hi Juan, Thanks for raising the ticket. I will look into it and possibly add a small script to reproduce what I?m facing. Best, Surya > On May 2, 2017, at 8:48 AM, Juan Nunez-Iglesias wrote: > > I?ve raised the issue: > https://github.com/scikit-image/scikit-image/issues/2646 > > On 29 Apr 2017, 5:40 AM +1000, Stefan van der Walt , wrote: >> It may well be that those two functions use opposite directions for theta. Do you mind filing an issue? >> >> Thanks >> St?fan >> >> On Fri, Apr 28, 2017, at 11:02, Surya Kasturi wrote: >>> Hi, >>> >>> I?m trying to use skimage.measure.EllipseModel to estimate an ellipse around a contour. The results seems to be not so satisfying. I am wondering if I am using ?orientation? parameter correctly. >>> >>> Could anyone please let me know whether ?theta? is in radians or degrees? / I am doing anything wrong? >>> >>> from skimage.measure import EllipseModel >>> >>> # create ellipse model >>> ellipse = EllipseModel() >>> ellipse.estimate(cnt) >>> >>> xc, yc, a, b, theta = np.array(ellipse.params, dtype=int) >>> >>> # find perimeter >>> rr, cc = draw.ellipse_perimeter(xc, yc, a, b, orientation=theta) >>> >>> # plot >>> ax.scatter(cc, rr, s=5, label="EllipseModel?) >>> >>> >>> >>> >>> >>> Thank you, >>> Surya >>> >>> _______________________________________________ >>> scikit-image mailing list >>> scikit-image at python.org >>> https://mail.python.org/mailman/listinfo/scikit-image >> _______________________________________________ >> scikit-image mailing list >> scikit-image at python.org >> https://mail.python.org/mailman/listinfo/scikit-image -------------- next part -------------- An HTML attachment was scrubbed... URL: From suryak at udel.edu Tue May 2 11:07:26 2017 From: suryak at udel.edu (Surya Kasturi) Date: Tue, 2 May 2017 11:07:26 -0400 Subject: [scikit-image] Making glare free photo scans In-Reply-To: References: Message-ID: <56D37769-5671-4D4E-A30C-F681A6F86942@udel.edu> Looks interesting ? If possible, I?ll take a look during the weekend and update. Surya > On May 2, 2017, at 9:55 AM, Juan Nunez-Iglesias wrote: > > Hi everyone, > > I recently saw this blog post from Google and was struck by how easily it could map to scikit-image functions. If anyone wants to make a blog post / gallery example, it would be most welcome. ;) > > https://research.googleblog.com/2017/04/photoscan-taking-glare-free-pictures-of.html > > Juan. > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image -------------- next part -------------- An HTML attachment was scrubbed... URL: From spencergardner at gmail.com Tue May 2 13:14:18 2017 From: spencergardner at gmail.com (Spencer Gardner) Date: Tue, 2 May 2017 12:14:18 -0500 Subject: [scikit-image] Help with MCP.goal_reached() in graph module Message-ID: The skimage.graph documentation states that the goal_reached method can be overloaded to introduce additional constraints on finding the minimum cost path. I'm having some trouble implementing this but I can't find any useful examples to follow online. I'm hoping someone can provide some guidance. I need to implement a minimum cost path through an array of costs. The added twist is that I need to ensure the path does not exceed some maximum geometric distance (represented as a total number of traversed cells). So I need my goal_reached() method to check whether the current path has exceeded the maximum number of cells and return 1 if true (which tells MCP to stop checking neighbors). Is there a good example implementation somewhere that I can refer to for some guidance? I've sketched out a rough outline but I'm not sure I'm on the right track: graph = MCP(costSurfaceArray,fully_connected=False) def goal_reached(index, cumcost): '''code to check total distance''' graph.goal_reached = goal_reached Thanks for any help! PS I posted this also on a Google Group that appears to be defunct. Apologies if that list is actually active and you got a double post from me. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zpincus at gmail.com Tue May 2 15:11:34 2017 From: zpincus at gmail.com (Zach Pincus) Date: Tue, 2 May 2017 14:11:34 -0500 Subject: [scikit-image] Help with MCP.goal_reached() in graph module In-Reply-To: References: Message-ID: > I need to implement a minimum cost path through an array of costs. The added > twist is that I need to ensure the path does not exceed some maximum > geometric distance (represented as a total number of traversed cells). So I > need my goal_reached() method to check whether the current path has exceeded > the maximum number of cells and return 1 if true (which tells MCP to stop > checking neighbors). > > Is there a good example implementation somewhere that I can refer to for > some guidance? I've sketched out a rough outline but I'm not sure I'm on the > right track: > > graph = MCP(costSurfaceArray,fully_connected=False) > > def goal_reached(index, cumcost): > '''code to check total distance''' > > graph.goal_reached = goal_reached First, note that MCP is implemented in cython, so you can't monkeypatch goal-reached like you could with a pure-python class. Instead you have to subclass: class MyMCP(MCP): def goal_reached(self, index, cumcost): print(index, cumcost) return 0 m = MyMCP(costSurfaceArray) Second, let's figure out about casting your problem in a way that goal_reached can address. Here's the documentation for goal_reached: """ int goal_reached(int index, float cumcost) This method is called each iteration after popping an index from the heap, before examining the neighbours. This method can be overloaded to modify the behavior of the MCP algorithm. An example might be to stop the algorithm when a certain cumulative cost is reached, or when the front is a certain distance away from the seed point. This method should return 1 if the algorithm should not check the current point's neighbours and 2 if the algorithm is now done. """ So basically, the function receives the "current" index (i.e. position in the array) under consideration, along with the minimum cost to get there. If the algorithm should not continue this portion of the search past that index, the function needs to return 1. If the algorithm should terminate wholesale, return 2. If all you needed to do was stop searching after you'd gotten a certain euclidian distance from the starting point, you could calculate that with just the index and knowledge of the starting points. However, you want to find out the current path length terminating in the current index. For this, you will need to deal with the MCP object's traceback_offsets attribute, which stores the paths to each point. For speed reasons, this is only available to subclasses written in cython, rather than pure-python. So you'll have to write it as a cpdef function in a cython subclass of MCP. For the implementation, you'll need to consult how MCP.traceback(self, end) is implemented, and run the same procedure in goal_reached() to simply count the length of the path and return 1 if the path exceeds your acceptable length: https://github.com/scikit-image/scikit-image/blob/master/skimage/graph/_mcp.pyx#L648 This won't be totally trivial, however. You'll need to understand a bit of cython, and a bit about how MCP works under the hood: it doesn't store indices as n-dimensional tuples like (x,y,z) coordinates or whatever. Instead it stores them as 1-dimensional indices into the flattened cost array. So much of the logic in the traceback() function is converting those indices around. Basically you'll just need to copy-paste traceback() into goal_reached() but instead of un-flattening the indices to append them to a traceback list, just count the number of links required to get to a starting point. Let me know if this helps. Zach On Tue, May 2, 2017 at 12:14 PM, Spencer Gardner wrote: > The skimage.graph documentation states that the goal_reached method can be > overloaded to introduce additional constraints on finding the minimum cost > path. I'm having some trouble implementing this but I can't find any useful > examples to follow online. I'm hoping someone can provide some guidance. > > I need to implement a minimum cost path through an array of costs. The added > twist is that I need to ensure the path does not exceed some maximum > geometric distance (represented as a total number of traversed cells). So I > need my goal_reached() method to check whether the current path has exceeded > the maximum number of cells and return 1 if true (which tells MCP to stop > checking neighbors). > > Is there a good example implementation somewhere that I can refer to for > some guidance? I've sketched out a rough outline but I'm not sure I'm on the > right track: > > graph = MCP(costSurfaceArray,fully_connected=False) > > def goal_reached(index, cumcost): > '''code to check total distance''' > > graph.goal_reached = goal_reached > > Thanks for any help! > > PS I posted this also on a Google Group that appears to be defunct. > Apologies if that list is actually active and you got a double post from me. > > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > From spencergardner at gmail.com Tue May 2 15:43:37 2017 From: spencergardner at gmail.com (Spencer Gardner) Date: Tue, 2 May 2017 14:43:37 -0500 Subject: [scikit-image] Help with MCP.goal_reached() in graph module In-Reply-To: References: Message-ID: Thanks. That's extremely helpful. I think I'll be able to work out the subclassing. I've never worked in cython but there's a first time for everything. Is there some alternative solution to my problem that I've missed? I've scoured the documentation from various software projects (GIS and non-GIS) to try to find something that implements an algorithm like this but I haven't come across anything. This seems odd to me, since it's a problem I assume others have had to solve before. In any case, I'm sure I'll be back with more questions as I dive in. Spencer On Tue, May 2, 2017 at 2:11 PM, Zach Pincus wrote: > > I need to implement a minimum cost path through an array of costs. The > added > > twist is that I need to ensure the path does not exceed some maximum > > geometric distance (represented as a total number of traversed cells). > So I > > need my goal_reached() method to check whether the current path has > exceeded > > the maximum number of cells and return 1 if true (which tells MCP to stop > > checking neighbors). > > > > Is there a good example implementation somewhere that I can refer to for > > some guidance? I've sketched out a rough outline but I'm not sure I'm on > the > > right track: > > > > graph = MCP(costSurfaceArray,fully_connected=False) > > > > def goal_reached(index, cumcost): > > '''code to check total distance''' > > > > graph.goal_reached = goal_reached > > First, note that MCP is implemented in cython, so you can't > monkeypatch goal-reached like you could with a pure-python class. > Instead you have to subclass: > > class MyMCP(MCP): > def goal_reached(self, index, cumcost): > print(index, cumcost) > return 0 > > m = MyMCP(costSurfaceArray) > > Second, let's figure out about casting your problem in a way that > goal_reached can address. Here's the documentation for goal_reached: > > """ int goal_reached(int index, float cumcost) > This method is called each iteration after popping an index > from the heap, before examining the neighbours. > This method can be overloaded to modify the behavior of the MCP > algorithm. An example might be to stop the algorithm when a > certain cumulative cost is reached, or when the front is a > certain distance away from the seed point. > This method should return 1 if the algorithm should not check > the current point's neighbours and 2 if the algorithm is now > done. > """ > > So basically, the function receives the "current" index (i.e. position > in the array) under consideration, along with the minimum cost to get > there. If the algorithm should not continue this portion of the search > past that index, the function needs to return 1. If the algorithm > should terminate wholesale, return 2. > > If all you needed to do was stop searching after you'd gotten a > certain euclidian distance from the starting point, you could > calculate that with just the index and knowledge of the starting > points. However, you want to find out the current path length > terminating in the current index. > > For this, you will need to deal with the MCP object's > traceback_offsets attribute, which stores the paths to each point. For > speed reasons, this is only available to subclasses written in cython, > rather than pure-python. So you'll have to write it as a cpdef > function in a cython subclass of MCP. > > For the implementation, you'll need to consult how MCP.traceback(self, > end) is implemented, and run the same procedure in goal_reached() to > simply count the length of the path and return 1 if the path exceeds > your acceptable length: > > https://github.com/scikit-image/scikit-image/blob/ > master/skimage/graph/_mcp.pyx#L648 > > This won't be totally trivial, however. You'll need to understand a > bit of cython, and a bit about how MCP works under the hood: it > doesn't store indices as n-dimensional tuples like (x,y,z) coordinates > or whatever. Instead it stores them as 1-dimensional indices into the > flattened cost array. So much of the logic in the traceback() function > is converting those indices around. Basically you'll just need to > copy-paste traceback() into goal_reached() but instead of > un-flattening the indices to append them to a traceback list, just > count the number of links required to get to a starting point. > > Let me know if this helps. > > Zach > > On Tue, May 2, 2017 at 12:14 PM, Spencer Gardner > wrote: > > The skimage.graph documentation states that the goal_reached method can > be > > overloaded to introduce additional constraints on finding the minimum > cost > > path. I'm having some trouble implementing this but I can't find any > useful > > examples to follow online. I'm hoping someone can provide some guidance. > > > > I need to implement a minimum cost path through an array of costs. The > added > > twist is that I need to ensure the path does not exceed some maximum > > geometric distance (represented as a total number of traversed cells). > So I > > need my goal_reached() method to check whether the current path has > exceeded > > the maximum number of cells and return 1 if true (which tells MCP to stop > > checking neighbors). > > > > Is there a good example implementation somewhere that I can refer to for > > some guidance? I've sketched out a rough outline but I'm not sure I'm on > the > > right track: > > > > graph = MCP(costSurfaceArray,fully_connected=False) > > > > def goal_reached(index, cumcost): > > '''code to check total distance''' > > > > graph.goal_reached = goal_reached > > > > Thanks for any help! > > > > PS I posted this also on a Google Group that appears to be defunct. > > Apologies if that list is actually active and you got a double post from > me. > > > > > > _______________________________________________ > > scikit-image mailing list > > scikit-image at python.org > > https://mail.python.org/mailman/listinfo/scikit-image > > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zpincus at gmail.com Tue May 2 16:01:58 2017 From: zpincus at gmail.com (Zach Pincus) Date: Tue, 2 May 2017 15:01:58 -0500 Subject: [scikit-image] Help with MCP.goal_reached() in graph module In-Reply-To: References: Message-ID: I can't think of any alternatives off the top of my head. The usual solution is to incorporate everything into your cost function, instead of having two separate stopping criteria -- most problems lend themselves to this pretty well. And actually, now that I think of it: Dijkstra's algorithm (which is all this graph traversal is running) fails with non-monotonic cost functions. Since the algorithm only visits a given position one time (on the minimum cost path), a shorter but more expensive path to the same point will not be considered, even if that is part of the path that gives a global optimum on your "minimum cost path below a certain length" problem. It would be a good advanced algorithms problem set question to consider if optimal solutions to that problem will necessarily be exponential in complexity. So that's why people usually try to blend their cost considerations into a single cost for traversing each node... That said, you might get OK solutions from this modified algorithm, though there will be no guarantee of global optimality. I can also think of one awful hack you could try to just see how well it works. You could "store" the number of steps in the cumulative cost by defining a custom travel_cost function. https://github.com/scikit-image/scikit-image/blob/master/skimage/graph/_mcp.pyx#L885 Let's assume that your "actual" costs are all >> 1. Then, instead of returning new_cost, you return new_cost + 0.001. Then goal_reached could count the number of steps by just looking at the value of the cumulative cost after the decimal point. Again, this is gross, and there are lots of cases where it won't work or will blow up badly. But for reasonably small maximum path lengths, it should be OK. Also, for speed you'll still need to implement this in a cython subclass. But you can use MCP_Flexible to proof out the implementation in slow pure python. On Tue, May 2, 2017 at 2:43 PM, Spencer Gardner wrote: > Thanks. That's extremely helpful. I think I'll be able to work out the > subclassing. I've never worked in cython but there's a first time for > everything. > > Is there some alternative solution to my problem that I've missed? I've > scoured the documentation from various software projects (GIS and non-GIS) > to try to find something that implements an algorithm like this but I > haven't come across anything. This seems odd to me, since it's a problem I > assume others have had to solve before. > > In any case, I'm sure I'll be back with more questions as I dive in. > > Spencer > > On Tue, May 2, 2017 at 2:11 PM, Zach Pincus wrote: >> >> > I need to implement a minimum cost path through an array of costs. The >> > added >> > twist is that I need to ensure the path does not exceed some maximum >> > geometric distance (represented as a total number of traversed cells). >> > So I >> > need my goal_reached() method to check whether the current path has >> > exceeded >> > the maximum number of cells and return 1 if true (which tells MCP to >> > stop >> > checking neighbors). >> > >> > Is there a good example implementation somewhere that I can refer to for >> > some guidance? I've sketched out a rough outline but I'm not sure I'm on >> > the >> > right track: >> > >> > graph = MCP(costSurfaceArray,fully_connected=False) >> > >> > def goal_reached(index, cumcost): >> > '''code to check total distance''' >> > >> > graph.goal_reached = goal_reached >> >> First, note that MCP is implemented in cython, so you can't >> monkeypatch goal-reached like you could with a pure-python class. >> Instead you have to subclass: >> >> class MyMCP(MCP): >> def goal_reached(self, index, cumcost): >> print(index, cumcost) >> return 0 >> >> m = MyMCP(costSurfaceArray) >> >> Second, let's figure out about casting your problem in a way that >> goal_reached can address. Here's the documentation for goal_reached: >> >> """ int goal_reached(int index, float cumcost) >> This method is called each iteration after popping an index >> from the heap, before examining the neighbours. >> This method can be overloaded to modify the behavior of the MCP >> algorithm. An example might be to stop the algorithm when a >> certain cumulative cost is reached, or when the front is a >> certain distance away from the seed point. >> This method should return 1 if the algorithm should not check >> the current point's neighbours and 2 if the algorithm is now >> done. >> """ >> >> So basically, the function receives the "current" index (i.e. position >> in the array) under consideration, along with the minimum cost to get >> there. If the algorithm should not continue this portion of the search >> past that index, the function needs to return 1. If the algorithm >> should terminate wholesale, return 2. >> >> If all you needed to do was stop searching after you'd gotten a >> certain euclidian distance from the starting point, you could >> calculate that with just the index and knowledge of the starting >> points. However, you want to find out the current path length >> terminating in the current index. >> >> For this, you will need to deal with the MCP object's >> traceback_offsets attribute, which stores the paths to each point. For >> speed reasons, this is only available to subclasses written in cython, >> rather than pure-python. So you'll have to write it as a cpdef >> function in a cython subclass of MCP. >> >> For the implementation, you'll need to consult how MCP.traceback(self, >> end) is implemented, and run the same procedure in goal_reached() to >> simply count the length of the path and return 1 if the path exceeds >> your acceptable length: >> >> >> https://github.com/scikit-image/scikit-image/blob/master/skimage/graph/_mcp.pyx#L648 >> >> This won't be totally trivial, however. You'll need to understand a >> bit of cython, and a bit about how MCP works under the hood: it >> doesn't store indices as n-dimensional tuples like (x,y,z) coordinates >> or whatever. Instead it stores them as 1-dimensional indices into the >> flattened cost array. So much of the logic in the traceback() function >> is converting those indices around. Basically you'll just need to >> copy-paste traceback() into goal_reached() but instead of >> un-flattening the indices to append them to a traceback list, just >> count the number of links required to get to a starting point. >> >> Let me know if this helps. >> >> Zach >> >> On Tue, May 2, 2017 at 12:14 PM, Spencer Gardner >> wrote: >> > The skimage.graph documentation states that the goal_reached method can >> > be >> > overloaded to introduce additional constraints on finding the minimum >> > cost >> > path. I'm having some trouble implementing this but I can't find any >> > useful >> > examples to follow online. I'm hoping someone can provide some guidance. >> > >> > I need to implement a minimum cost path through an array of costs. The >> > added >> > twist is that I need to ensure the path does not exceed some maximum >> > geometric distance (represented as a total number of traversed cells). >> > So I >> > need my goal_reached() method to check whether the current path has >> > exceeded >> > the maximum number of cells and return 1 if true (which tells MCP to >> > stop >> > checking neighbors). >> > >> > Is there a good example implementation somewhere that I can refer to for >> > some guidance? I've sketched out a rough outline but I'm not sure I'm on >> > the >> > right track: >> > >> > graph = MCP(costSurfaceArray,fully_connected=False) >> > >> > def goal_reached(index, cumcost): >> > '''code to check total distance''' >> > >> > graph.goal_reached = goal_reached >> > >> > Thanks for any help! >> > >> > PS I posted this also on a Google Group that appears to be defunct. >> > Apologies if that list is actually active and you got a double post from >> > me. >> > >> > >> > _______________________________________________ >> > scikit-image mailing list >> > scikit-image at python.org >> > https://mail.python.org/mailman/listinfo/scikit-image >> > >> _______________________________________________ >> scikit-image mailing list >> scikit-image at python.org >> https://mail.python.org/mailman/listinfo/scikit-image > > > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > From spencergardner at gmail.com Tue May 2 17:40:00 2017 From: spencergardner at gmail.com (Spencer Gardner) Date: Tue, 2 May 2017 16:40:00 -0500 Subject: [scikit-image] Help with MCP.goal_reached() in graph module In-Reply-To: References: Message-ID: Good point. Hadn't thought about the monotonic problem with Dijkstra. My problem is I need the costs to represent considerations other than pure distance but my ultimate outcome must be constrained by a total distance, so there's not really a good way that I can see to fold them together. One strategy I've been planning to investigate is developing an unconstrained cumulative cost matrix for each origin point and each destination point and then sum the O + D matrices to get the total route cost for the pair at every matrix coordinate. I'm not completely sure how I can use that to identify a route within my distance constraints but I think it might be a promising option. On Tue, May 2, 2017 at 3:01 PM, Zach Pincus wrote: > I can't think of any alternatives off the top of my head. The usual > solution is to incorporate everything into your cost function, instead > of having two separate stopping criteria -- most problems lend > themselves to this pretty well. > > And actually, now that I think of it: Dijkstra's algorithm (which is > all this graph traversal is running) fails with non-monotonic cost > functions. Since the algorithm only visits a given position one time > (on the minimum cost path), a shorter but more expensive path to the > same point will not be considered, even if that is part of the path > that gives a global optimum on your "minimum cost path below a certain > length" problem. It would be a good advanced algorithms problem set > question to consider if optimal solutions to that problem will > necessarily be exponential in complexity. > > So that's why people usually try to blend their cost considerations > into a single cost for traversing each node... > > That said, you might get OK solutions from this modified algorithm, > though there will be no guarantee of global optimality. > > I can also think of one awful hack you could try to just see how well > it works. You could "store" the number of steps in the cumulative cost > by defining a custom travel_cost function. > https://github.com/scikit-image/scikit-image/blob/ > master/skimage/graph/_mcp.pyx#L885 > > Let's assume that your "actual" costs are all >> 1. Then, instead of > returning new_cost, you return new_cost + 0.001. Then goal_reached > could count the number of steps by just looking at the value of the > cumulative cost after the decimal point. > > Again, this is gross, and there are lots of cases where it won't work > or will blow up badly. But for reasonably small maximum path lengths, > it should be OK. Also, for speed you'll still need to implement this > in a cython subclass. But you can use MCP_Flexible to proof out the > implementation in slow pure python. > > > > > On Tue, May 2, 2017 at 2:43 PM, Spencer Gardner > wrote: > > Thanks. That's extremely helpful. I think I'll be able to work out the > > subclassing. I've never worked in cython but there's a first time for > > everything. > > > > Is there some alternative solution to my problem that I've missed? I've > > scoured the documentation from various software projects (GIS and > non-GIS) > > to try to find something that implements an algorithm like this but I > > haven't come across anything. This seems odd to me, since it's a problem > I > > assume others have had to solve before. > > > > In any case, I'm sure I'll be back with more questions as I dive in. > > > > Spencer > > > > On Tue, May 2, 2017 at 2:11 PM, Zach Pincus wrote: > >> > >> > I need to implement a minimum cost path through an array of costs. The > >> > added > >> > twist is that I need to ensure the path does not exceed some maximum > >> > geometric distance (represented as a total number of traversed cells). > >> > So I > >> > need my goal_reached() method to check whether the current path has > >> > exceeded > >> > the maximum number of cells and return 1 if true (which tells MCP to > >> > stop > >> > checking neighbors). > >> > > >> > Is there a good example implementation somewhere that I can refer to > for > >> > some guidance? I've sketched out a rough outline but I'm not sure I'm > on > >> > the > >> > right track: > >> > > >> > graph = MCP(costSurfaceArray,fully_connected=False) > >> > > >> > def goal_reached(index, cumcost): > >> > '''code to check total distance''' > >> > > >> > graph.goal_reached = goal_reached > >> > >> First, note that MCP is implemented in cython, so you can't > >> monkeypatch goal-reached like you could with a pure-python class. > >> Instead you have to subclass: > >> > >> class MyMCP(MCP): > >> def goal_reached(self, index, cumcost): > >> print(index, cumcost) > >> return 0 > >> > >> m = MyMCP(costSurfaceArray) > >> > >> Second, let's figure out about casting your problem in a way that > >> goal_reached can address. Here's the documentation for goal_reached: > >> > >> """ int goal_reached(int index, float cumcost) > >> This method is called each iteration after popping an index > >> from the heap, before examining the neighbours. > >> This method can be overloaded to modify the behavior of the MCP > >> algorithm. An example might be to stop the algorithm when a > >> certain cumulative cost is reached, or when the front is a > >> certain distance away from the seed point. > >> This method should return 1 if the algorithm should not check > >> the current point's neighbours and 2 if the algorithm is now > >> done. > >> """ > >> > >> So basically, the function receives the "current" index (i.e. position > >> in the array) under consideration, along with the minimum cost to get > >> there. If the algorithm should not continue this portion of the search > >> past that index, the function needs to return 1. If the algorithm > >> should terminate wholesale, return 2. > >> > >> If all you needed to do was stop searching after you'd gotten a > >> certain euclidian distance from the starting point, you could > >> calculate that with just the index and knowledge of the starting > >> points. However, you want to find out the current path length > >> terminating in the current index. > >> > >> For this, you will need to deal with the MCP object's > >> traceback_offsets attribute, which stores the paths to each point. For > >> speed reasons, this is only available to subclasses written in cython, > >> rather than pure-python. So you'll have to write it as a cpdef > >> function in a cython subclass of MCP. > >> > >> For the implementation, you'll need to consult how MCP.traceback(self, > >> end) is implemented, and run the same procedure in goal_reached() to > >> simply count the length of the path and return 1 if the path exceeds > >> your acceptable length: > >> > >> > >> https://github.com/scikit-image/scikit-image/blob/ > master/skimage/graph/_mcp.pyx#L648 > >> > >> This won't be totally trivial, however. You'll need to understand a > >> bit of cython, and a bit about how MCP works under the hood: it > >> doesn't store indices as n-dimensional tuples like (x,y,z) coordinates > >> or whatever. Instead it stores them as 1-dimensional indices into the > >> flattened cost array. So much of the logic in the traceback() function > >> is converting those indices around. Basically you'll just need to > >> copy-paste traceback() into goal_reached() but instead of > >> un-flattening the indices to append them to a traceback list, just > >> count the number of links required to get to a starting point. > >> > >> Let me know if this helps. > >> > >> Zach > >> > >> On Tue, May 2, 2017 at 12:14 PM, Spencer Gardner > >> wrote: > >> > The skimage.graph documentation states that the goal_reached method > can > >> > be > >> > overloaded to introduce additional constraints on finding the minimum > >> > cost > >> > path. I'm having some trouble implementing this but I can't find any > >> > useful > >> > examples to follow online. I'm hoping someone can provide some > guidance. > >> > > >> > I need to implement a minimum cost path through an array of costs. The > >> > added > >> > twist is that I need to ensure the path does not exceed some maximum > >> > geometric distance (represented as a total number of traversed cells). > >> > So I > >> > need my goal_reached() method to check whether the current path has > >> > exceeded > >> > the maximum number of cells and return 1 if true (which tells MCP to > >> > stop > >> > checking neighbors). > >> > > >> > Is there a good example implementation somewhere that I can refer to > for > >> > some guidance? I've sketched out a rough outline but I'm not sure I'm > on > >> > the > >> > right track: > >> > > >> > graph = MCP(costSurfaceArray,fully_connected=False) > >> > > >> > def goal_reached(index, cumcost): > >> > '''code to check total distance''' > >> > > >> > graph.goal_reached = goal_reached > >> > > >> > Thanks for any help! > >> > > >> > PS I posted this also on a Google Group that appears to be defunct. > >> > Apologies if that list is actually active and you got a double post > from > >> > me. > >> > > >> > > >> > _______________________________________________ > >> > scikit-image mailing list > >> > scikit-image at python.org > >> > https://mail.python.org/mailman/listinfo/scikit-image > >> > > >> _______________________________________________ > >> scikit-image mailing list > >> scikit-image at python.org > >> https://mail.python.org/mailman/listinfo/scikit-image > > > > > > > > _______________________________________________ > > scikit-image mailing list > > scikit-image at python.org > > https://mail.python.org/mailman/listinfo/scikit-image > > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefanv at berkeley.edu Wed May 3 01:09:56 2017 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Tue, 02 May 2017 22:09:56 -0700 Subject: [scikit-image] New logo? Message-ID: <1493788196.2624908.963956384.603B1279@webmail.messagingengine.com> Hi, everyone It's been bothering me for a while that we have a logo that is not colorblind friendly. E.g., try running scikit-image.org through https://www.toptal.com/designers/colorfilter :/ *I challenge you to submit a new logo, and a hexagonal sticker [0] that we can print for SciPy 2017.** * I will print and ship stickers of the (community) chosen design to anyone who contributes a design of their own. Fire up Inkscape [1], and let's see you work your magic! St?fan [0] http://hexb.in/sticker.html [1] https://github.com/terinjokes/StickerConstructorSpec/blob/master/assets/hexagonal-sticker_template.svg -------------- next part -------------- An HTML attachment was scrubbed... URL: From kmichael.aye at gmail.com Wed May 3 01:23:58 2017 From: kmichael.aye at gmail.com (K.-Michael Aye) Date: Tue, 2 May 2017 23:23:58 -0600 Subject: [scikit-image] New logo? In-Reply-To: <1493788196.2624908.963956384.603B1279@webmail.messagingengine.com> References: <1493788196.2624908.963956384.603B1279@webmail.messagingengine.com> Message-ID: At least it?s fine for Tritanopians! ;) Good effort! Michael > On May 2, 2017, at 23:09, Stefan van der Walt wrote: > > Hi, everyone > > It's been bothering me for a while that we have a logo that is not colorblind friendly. > > E.g., try running scikit-image.org through > > https://www.toptal.com/designers/colorfilter > > :/ > > I challenge you to submit a new logo, and a hexagonal sticker [0] that we can print for SciPy 2017. > > I will print and ship stickers of the (community) chosen design to anyone who contributes a design of their own. > > Fire up Inkscape [1], and let's see you work your magic! > St?fan > > > [0] http://hexb.in/sticker.html > [1] https://github.com/terinjokes/StickerConstructorSpec/blob/master/assets/hexagonal-sticker_template.svg > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image From noflaco at gmail.com Sat May 13 22:44:50 2017 From: noflaco at gmail.com (Carlton Banks) Date: Sun, 14 May 2017 04:44:50 +0200 Subject: [scikit-image] Storing a plot into a bumpy array such that it can be used for pattern recognition... Message-ID: <8B63BF09-B9D2-4FFF-83C8-3F3A90198BF5@gmail.com> I seem to have some problems storing a plot created using matplotlib.pcolormesh(). As far i know is pcolormesh convert an input data matrix given a colormap, and the colormap gives a RGB values for each entries in matrix and plots it. Which in my head would be similar to import numpy as np import matplotlib.pyplot as plt import matplotlib from PIL import Image import librosa import librosa.display from matplotlib import cm fig = plt.figure(figsize=(12,4)) min = -1.828067 max = 22.70058 data = np.random.uniform(low=min, high=max, size=(474,40)) librosa.display.specshow(data.T,sr=16000,x_axis='frames',y_axis='mel',hop_length=160,cmap=cm.jet) plt.axis('off') plt.show() raw_input("sadas") convert = plt.get_cmap(cm.jet) norm = matplotlib.colors.Normalize(vmin=0,vmax=1) numpy_output_static = convert(norm(data.T)) plt.imshow(numpy_output_static,cmap = cm.jet, aspect = 'auto') plt.show() raw_input("asds?) Problem here is I need to store as a numpy array, and the data has to represent the plot as the array is being used as an input for a NN, in which input matters, and won't be able learn anything if the input doesn't resemble or show the same patterns which the NN has to learn. So how do make it store the actual plot, and keep the dimensions of data that used to make the plot. You may notice I am using librosa to make the plot above. Librosa basically do a pcolormesh plot, in which the argument only set the x-axis and y-axis , and scale them to the proper size. here is the actual source code: https://github.com/librosa/librosa/blob/master/librosa/display.py#L459 Here is the first image: Here is the second image: -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: bY0FU.png Type: image/png Size: 89483 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: PKXx7.png Type: image/png Size: 33085 bytes Desc: not available URL: From jesukirann at gmail.com Mon May 15 05:48:14 2017 From: jesukirann at gmail.com (Jesu Kiran Spurgen) Date: Mon, 15 May 2017 11:48:14 +0200 Subject: [scikit-image] Reg: Working to create an ROI interactively and then find contours. Message-ID: Dear Experts, I have been able to successfully find the contours on an entire image. However,I am more interested to define an ROI interactively and then find the contours for it, whilst preserving the other parts of the image without any contour-finding. This is what I'd like to do: * Create the ROI interactively for the input image * Find contours on that ROI (without cropping the ROI away from the rest of image) * Other parts (which are not in the ROI) should remain untouched. *Link1:* The link I used to find the interactive rectangle is: http://stackoverflow.com/questions/21696097/how-can-i-make-a-draggable-adjustable-roi-in-opencv-python/21696862#21696862 To find contours, I use OpenCV. Any suggestions/help/code would be great! Thanks, P.S: Sorry for these questions, but I would be ever grateful for a gentle and kind reply. I am new to OpenCV and SciKit, hence this question. Many thanks! Looking forward for your kind response. Please kindly let me know if I could provide with more information. Best Regards, Kiran -------------- next part -------------- An HTML attachment was scrubbed... URL: From imagepy at sina.com Mon May 15 05:52:15 2017 From: imagepy at sina.com (imagepy at sina.com) Date: Mon, 15 May 2017 17:52:15 +0800 Subject: [scikit-image] =?gbk?b?u9i4tDogUmVnOiBXb3JraW5nIHRvIGNyZWF0ZSBh?= =?gbk?q?n_ROI_interactively_and_then_find_contours=2E?= Message-ID: <20170515095215.E04194C0ABA@webmail.sinamail.sina.com.cn> https://github.com/yxdragon/imagepy -------------------------------- my project. have a look. make scikitimage like photoshop! -------- ???? -------- ???:Jesu Kiran Spurgen ??????:2017?5?15? 17:48(???) ???:scikit-image at python.org ??:[scikit-image] Reg: Working to create an ROI interactively and then find contours. Dear Experts, I have been able to successfully find the contours on an entire image.?? However,I am more interested to define an ROI interactively and then find thecontours for it, whilst preserving the other parts of the image without anycontour-finding. ?This is what I'd like to do: ? ? * Create the ROI interactively for the input image? ??? ? * Find contours on that ROI (without cropping the ROI away from the rest of image)? ??? ? * Other parts (which are not in the ROI) should remain untouched.? Link1: The link I used to find the interactive rectangle is: http://stackoverflow.com/questions/21696097/how-can-i-make-a-draggable-adjustable-roi-in-opencv-python/21696862#21696862 To find contours, I use OpenCV.? Any suggestions/help/code would be great! Thanks, P.S: Sorry for these questions, but I would be ever grateful for a gentle and kind reply. I am new to OpenCV and SciKit, hence this question. Many thanks! Looking forward for your kind response. Please kindly let me know if I could provide with more information. Best Regards,Kiran _______________________________________________ scikit-image mailing list scikit-image at python.org https://mail.python.org/mailman/listinfo/scikit-image -------------- next part -------------- An HTML attachment was scrubbed... URL: From imagepy at sina.com Mon May 15 06:01:08 2017 From: imagepy at sina.com (imagepy at sina.com) Date: Mon, 15 May 2017 18:01:08 +0800 Subject: [scikit-image] =?gbk?b?u9i4tKO6IFJlZzogV29ya2luZyB0byBjcmVhdGUg?= =?gbk?q?an_ROI_interactively_and_then_find_contours=2E?= Message-ID: <20170515100108.B503238053E@webmail.sinamail.sina.com.cn> It can wrap any function based on numpy, (spicy, scikit-image, opencv, itk ...). This framework can generate interactive dialog automatically acrroding your function's parameter. and support roi, mask, undo. You just need to care your function! It can run on win, Mac, linux under py2.7 or py3x now! (I just make a framework like ImageJ, but more flexable) ----- ???? ----- ????Jesu Kiran Spurgen ????scikit-image at python.org ???[scikit-image] Reg: Working to create an ROI interactively and then find contours. ???2017?05?15? 17?48? Dear Experts, I have been able to successfully find the contours on an entire image. However,I am more interested to define an ROI interactively and then find thecontours for it, whilst preserving the other parts of the image without anycontour-finding. This is what I'd like to do: * Create the ROI interactively for the input image * Find contours on that ROI (without cropping the ROI away from the rest of image) * Other parts (which are not in the ROI) should remain untouched. Link1: The link I used to find the interactive rectangle is: http://stackoverflow.com/questions/21696097/how-can-i-make-a-draggable-adjustable-roi-in-opencv-python/21696862#21696862 To find contours, I use OpenCV. Any suggestions/help/code would be great! Thanks, P.S: Sorry for these questions, but I would be ever grateful for a gentle and kind reply. I am new to OpenCV and SciKit, hence this question. Many thanks! Looking forward for your kind response. Please kindly let me know if I could provide with more information. Best Regards,Kiran _______________________________________________ scikit-image mailing list scikit-image at python.org https://mail.python.org/mailman/listinfo/scikit-image -------------- next part -------------- An HTML attachment was scrubbed... URL: From imagepy at sina.com Wed May 17 23:07:32 2017 From: imagepy at sina.com (imagepy at sina.com) Date: Thu, 18 May 2017 11:07:32 +0800 Subject: [scikit-image] build topograph network from skeleton Message-ID: <20170518030732.8F705380546@webmail.sinamail.sina.com.cn> Hi everyone: I saw the newest version, require the networkx module. I find some function to find shortest path from image. But I want to know if there is a method to build a network from a skeleton image(2D/3D with arcs and nodes). I wrote one, but in python. it runs very slowly... yxdragon-imagepy -------------- next part -------------- An HTML attachment was scrubbed... URL: From leenagour at gmail.com Thu May 18 00:04:36 2017 From: leenagour at gmail.com (Leena Chourey) Date: Thu, 18 May 2017 09:34:36 +0530 Subject: [scikit-image] Need help to get graph from image Message-ID: Dear All, I need to convert shape based image(graph_search2.jpg) into graph and then graph data structure. I have tried to filter the image and then with threshold, contour based approach access shapes(nodes), lines(edges) and arrows. but facing difficulty in getting relation b/w nodes and edges. Please help to find interest point(interest_points.jpg) and relation in node n edges. -- Thanks & Regards, -??????? Leena Chourey , ???? ???? C-DAC Mumbai ??-???, ?????? -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: graph_search2.jpg Type: image/jpeg Size: 33372 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: interest_points.jpg Type: image/jpeg Size: 24848 bytes Desc: not available URL: From imagepy at sina.com Thu May 18 01:12:05 2017 From: imagepy at sina.com (imagepy at sina.com) Date: Thu, 18 May 2017 13:12:05 +0800 Subject: [scikit-image] =?gbk?q?=BB=D8=B8=B4=3A_Need_help_to_get_graph_fr?= =?gbk?q?om_image?= Message-ID: <20170518051205.E2735380546@webmail.sinamail.sina.com.cn> 1. you can do a skeleton, then use a np.ones((3,3)) to convolve. then 3 means junction, one means termin. 2 means path.2. trace from a termin. iterate all the pixel > 0. and add node if != 2! some tips:1. if you do skeleton straightly, you will get some small branch, you can remove them by graph analysis. but I have a tip, you can do a gauss blur, then threshold again. this will smooth the binary image.2. trace the path is not very simple, you need care many detail... you can look mine.3. the scikit-image's skeleton method prefers to generate branch (sometimes we want, but here we need not), you can look here. you can have a try my project imagery do some test. which can wrap scikit-image like photoshop!(but I do not know if scikit-image has a method to build the skeleton) My English is solo, forgive me. YXDragon - ImagePy--------------------------------????????android???-------- ???? --------???:Leena Chourey? ?:2017?5?18? 12:05(???)???:scikit-image at python.org??:[scikit-image] Need help to get graph from imageDear All,I need to convert shape based image(graph_search2.jpg) into graph and then graph data structure. I have tried to filter the image and then with threshold, contour based approach access shapes(nodes), lines(edges) and arrows. but facing difficulty in getting relation b/w nodes and edges. Please help to find interest point(interest_points.jpg) and relation in node n edges.-- Thanks & Regards, -???????Leena Chourey , ???? ???? C-DAC Mumbai ??-???, ?????? _______________________________________________scikit-image mailing listscikit-image at python.orghttps://mail.python.org/mailman/listinfo/scikit-image -------------------------------- ????????android??? -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 1.png Type: image/png Size: 5620 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 2.png Type: image/png Size: 4726 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 3.png Type: image/png Size: 7123 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: demo.png Type: image/png Size: 226270 bytes Desc: not available URL: From leenagour at gmail.com Thu May 18 01:23:41 2017 From: leenagour at gmail.com (Leena Chourey) Date: Thu, 18 May 2017 10:53:41 +0530 Subject: [scikit-image] =?utf-8?b?5Zue5aSNOiBOZWVkIGhlbHAgdG8gZ2V0IGdy?= =?utf-8?q?aph_from_image?= In-Reply-To: <20170518051205.E2735380546@webmail.sinamail.sina.com.cn> References: <20170518051205.E2735380546@webmail.sinamail.sina.com.cn> Message-ID: Thanks YXDragon for quick reply. 1. Yes I have tried skeletonisation but hanged for further processing. hope the links u have sent will help to resolve. 2. Wow.. great. that is exactly I need and done partially. Can u pls explain the 1.jpg--->2.jpg--->3.jpg. I want exactly the same 3.jpg (junction points). Can i call imagepy in my python script and get the o/p of it for further processing? 3. Is it possible to convert directly image to graph data structure? On Thu, May 18, 2017 at 10:42 AM, wrote: > 1. you can do a skeleton, then use a np.ones((3,3)) to convolve. then 3 > means junction, one means termin. 2 means path. > 2. trace from a termin. iterate all the pixel > 0. and add node if != 2! > > some tips: > 1. if you do skeleton straightly, you will get some small branch, you can > remove them by graph analysis. but I have a tip, you can do a gauss blur, > then threshold again. this will smooth the binary image. > 2. trace the path is not very simple, you need care many detail... you can > look mine. > > 3. the scikit-image's skeleton method prefers to generate branch > (sometimes we want, but here we need not), you can look here > . > > > you can have a try my project imagery > do some test. which can wrap > scikit-image like photoshop! > (but I do not know if scikit-image has a method to build the skeleton) > > My English is solo, forgive me. > YXDragon - ImagePy > -------------------------------- > > ????????android??? > > -------- ???? -------- > > ???:Leena Chourey > > ? ?:2017?5?18? 12:05(???) > > ???:scikit-image at python.org > > ??:[scikit-image] Need help to get graph from image > > Dear All, > > I need to convert shape based image(graph_search2.jpg) into graph and then > graph data structure. I have tried to filter the image and then with > threshold, contour based approach access shapes(nodes), lines(edges) and > arrows. but facing difficulty in getting relation b/w nodes and edges. > Please help to find interest point(interest_points.jpg) and relation in > node n edges. > > -- > > Thanks & Regards, -??????? > > Leena Chourey , ???? ???? > > C-DAC Mumbai ??-???, ?????? > > _______________________________________________ > > scikit-image mailing list > > scikit-image at python.org > > https://mail.python.org/mailman/listinfo/scikit-image > > > -------------------------------- > > ????????android??? > > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > > -- Thanks & Regards, -??????? Leena Chourey , ???? ???? C-DAC Mumbai ??-???, ?????? -------------- next part -------------- An HTML attachment was scrubbed... URL: From imagepy at sina.com Thu May 18 02:06:08 2017 From: imagepy at sina.com (imagepy at sina.com) Date: Thu, 18 May 2017 14:06:08 +0800 Subject: [scikit-image] =?gbk?b?u9i4tDpSZTogILvYuLQ6IE5lZWQgaGVscCB0byBn?= =?gbk?q?et_graph_from_image?= Message-ID: <20170518060608.D30762E0121@webmail.sinamail.sina.com.cn> I has build the networt, look tips 2. imagepy is not a function library, but a interactive framework witch can wrap numpy, scipy, scikitimage, opencv as a friendly.software. by another, please donot save picture as jpg. the dct transform may destroy the high frequent information. -------------------------------- ????????android??? -------- ???? -------- ???:Leena Chourey ??????:2017?5?18? 13:30(???) ???:imagepy at sina.com Mailing list for scikit-image (http://scikit-image.org) ??:Re: [scikit-image] ??: Need help to get graph from image Thanks?YXDragon?for quick reply.?Yes I have tried skeletonisation but hanged for further processing. hope the links u have sent will help to resolve.Wow.. great. that is exactly I need and done partially.?Can u pls explain the 1.jpg--->2.jpg--->3.jpg. I want exactly the same 3.jpg (junction points). Can i call imagepy in my python script and get the o/p of it for further processing?Is it possible to convert directly image to graph data structure? On Thu, May 18, 2017 at 10:42 AM, wrote: 1. you can do a skeleton, then use a np.ones((3,3)) to convolve. then 3 means junction, one means termin. 2 means path.2. trace from a termin. iterate all the pixel > 0. and add node if != 2! some tips:1. if you do skeleton straightly, you will get some small branch, you can remove them by graph analysis. but I have a tip, you can do a gauss blur, then threshold again. this will smooth the binary image.2. trace the path is not very simple, you need care many detail... you can look mine.3. the scikit-image's skeleton method prefers to generate branch (sometimes we want, but here we need not), you can look here. you can have a try my project imagery do some test. which can wrap scikit-image like photoshop!(but I do not know if scikit-image has a method to build the skeleton) My English is solo, forgive me. YXDragon -?ImagePy--------------------------------????????android???-------- ???? --------???:Leena Chourey??????:2017?5?18? 12:05(???)???:scikit-image at python.org??:[scikit-image] Need help to get graph from imageDear All,I need to convert shape based image(graph_search2.jpg) into graph and then graph data structure. I have tried to filter the image and then with threshold, contour based approach access shapes(nodes), lines(edges) and arrows. but facing difficulty in getting relation b/w nodes and edges. Please help to find interest point(interest_points.jpg) and relation in node n edges.-- Thanks & Regards, -???????Leena Chourey , ???? ?????C-DAC Mumbai ??-???, ???????_______________________________________________scikit-image mailing listscikit-image at python.orghttps://mail.python.org/mailman/listinfo/scikit-image -------------------------------- ????????android??? _______________________________________________ scikit-image mailing list scikit-image at python.org https://mail.python.org/mailman/listinfo/scikit-image -- Thanks & Regards, -???????Leena Chourey , ???? ?????C-DAC Mumbai ??-???, ??????? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jni.soma at gmail.com Thu May 18 03:12:29 2017 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Thu, 18 May 2017 17:12:29 +1000 Subject: [scikit-image] build topograph network from skeleton In-Reply-To: <20170518030732.8F705380546@webmail.sinamail.sina.com.cn> References: <20170518030732.8F705380546@webmail.sinamail.sina.com.cn> Message-ID: <4f5e3ee9-3b8b-4752-b0fa-0780f95c8708@Spark> Hi YXDragon! Coincidentally, I have been working on a package to do just that, which I have imaginatively-called ?skan? (for SKeleton ANalysis). It runs lightning quick using Numba, and works with n-D skeletons. It?s available on pip (pip install skan) and conda-forge (conda install -c conda-forge skan). The source code is on github (github.com/jni/skan). The interface is a little fiddly currently but you should be able to figure it out. The functions you want are skan.csr.skeleton_to_csgraph (produces a pixel-to-pixel graph in scipy.sparse.csr_matrix format) and skan.csr.summarise (produces a pandas DataFrame with nodes and arcs, including coordinates in the image, arc distances, and euclidean distances). You just need to provide the skeleton. I hope this helps! Feedback on the API is much appreciated! Juan. PS: Oh yeah, you might want to look at my Numba post, which described part of the development of this library:?https://ilovesymposia.com/2016/12/20/numba-in-the-real-world/ On 18 May 2017, 1:08 PM +1000, imagepy at sina.com, wrote: > ?Hi everyone: > ? ? I saw the newest version, require the networkx module. I find some function to find shortest path from image. But I want to know if there is a method to build a network from a skeleton image(2D/3D with arcs and nodes). I wrote one, but in python. it runs very slowly... > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?yxdragon-imagepy > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeanpatrick.pommier at gmail.com Fri May 19 02:46:44 2017 From: jeanpatrick.pommier at gmail.com (Jean-Patrick Pommier) Date: Fri, 19 May 2017 08:46:44 +0200 Subject: [scikit-image] build topograph network from skeleton In-Reply-To: <4f5e3ee9-3b8b-4752-b0fa-0780f95c8708@Spark> References: <20170518030732.8F705380546@webmail.sinamail.sina.com.cn> <4f5e3ee9-3b8b-4752-b0fa-0780f95c8708@Spark> Message-ID: Hi, I wrote some time ago: http://dip4fish.blogspot.fr/2014/05/construct-graph-from-skeleton-image-of.html http://dip4fish.blogspot.fr/2014/06/graph-again.html http://dip4fish.blogspot.fr/2015/11/prune-iteratively-leaves-of-toy-graph.html https://gist.github.com/jeanpat/aac681d6b56932941281 hope this help 2017-05-18 9:12 GMT+02:00 Juan Nunez-Iglesias : > Hi YXDragon! > > Coincidentally, I have been working on a package to do just that, which I > have imaginatively-called ?skan? (for SKeleton ANalysis). It runs lightning > quick using Numba, and works with n-D skeletons. It?s available on pip (pip > install skan) and conda-forge (conda install -c conda-forge skan). The > source code is on github (github.com/jni/skan). > > The interface is a little fiddly currently but you should be able to > figure it out. The functions you want are skan.csr.skeleton_to_csgraph > (produces a pixel-to-pixel graph in scipy.sparse.csr_matrix format) and > skan.csr.summarise (produces a pandas DataFrame with nodes and arcs, > including coordinates in the image, arc distances, and euclidean > distances). You just need to provide the skeleton. > > I hope this helps! Feedback on the API is much appreciated! > > Juan. > > PS: Oh yeah, you might want to look at my Numba post, which described part > of the development of this library: https://ilovesymposia.com/2016/12/20/ > numba-in-the-real-world/ > > On 18 May 2017, 1:08 PM +1000, imagepy at sina.com, wrote: > > Hi everyone: > I saw the newest version, require the networkx module. I find some > function to find shortest path from image. But I want to know if there is a > method to build a network from a skeleton image(2D/3D with arcs and nodes). > I wrote one, but in python. it runs very slowly... > yxdragon-imagepy > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image > > -- http://dip4fish.blogspot.fr/ Dedicated to Digital Image Processing for FISH, QFISH and other things about the telomeres. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pskeshu at gmail.com Fri May 19 12:40:05 2017 From: pskeshu at gmail.com (Kesavan Subburam) Date: Fri, 19 May 2017 22:10:05 +0530 Subject: [scikit-image] Viewing 3D images/stacks of images Message-ID: Hi all, I'd used CollectionViewer from skimage.viewer before for viewing microscopy Z stacks. However, I personally felt it was a bit of a pain to use. For instance, before passing in an array of images, the image has to be stretched, otherwise, most of the time, one would end up with a "black" series of images. So, I wrote a simple function using matplotlib to view image collections, which works quite well, and I think it can be extended to display nD images with multiple sliders. def ddd(images): def _update_image(num): num = int(num) image = np.squeeze(images[num:num+1]) img_ax.set_data(image) fig.canvas.draw_idle() if images.ndim is not 3: raise ValueError("Not a 3D image.") Z, _, _ = images.shape fig, ax = plt.subplots() img_ax = ax.imshow(np.squeeze(images[0]), cmap="gray") ax.axis("off") sliderax = plt.axes([0.19, 0.05, 0.65, 0.03], facecolor="lightgoldenrodyellow") img_slider = Slider(sliderax, "Z", 0, Z-1, valfmt='%d', valinit=0) img_slider.on_changed(_update_image) plt.show() This might be a bit redundant, but I would like your thoughts on whether this might be useful for scikit-image. Some of the plugins of CollectionViewer can be rewritten for this matplotlib based approach in a much more readable fashion -- for instance, the line profile plugin. Best, -- Kesavan Subburam -------------- next part -------------- An HTML attachment was scrubbed... URL: From pskeshu at gmail.com Fri May 19 12:45:21 2017 From: pskeshu at gmail.com (Kesavan Subburam) Date: Fri, 19 May 2017 22:15:21 +0530 Subject: [scikit-image] Viewing 3D images/stacks of images In-Reply-To: References: Message-ID: from matplotlib.widgets import Slider import matplotlib.pyplot as plt import numpy as np def ddd(images): def _update_image(num): num = int(num) image = np.squeeze(images[num:num+1]) img_ax.set_data(image) fig.canvas.draw_idle() if images.ndim is not 3: raise ValueError("Not a 3D image.") Z, _, _ = images.shape fig, ax = plt.subplots() img_ax = ax.imshow(np.squeeze(images[0]), cmap="gray") ax.axis("off") sliderax = plt.axes([0.19, 0.05, 0.65, 0.03], facecolor="lightgoldenrodyellow") img_slider = Slider(sliderax, "Z", 0, Z-1, valfmt='%d', valinit=0) img_slider.on_changed(_update_image) plt.show() I'd forgotten to include the import statements. Just in case you'd like to test the code. Input image of shape (Z, N, M). On 19 May 2017 at 22:10, Kesavan Subburam wrote: > Hi all, > > I'd used CollectionViewer from skimage.viewer before for viewing > microscopy Z stacks. However, I personally felt it was a bit of a pain to > use. For instance, before passing in an array of images, the image has to > be stretched, otherwise, most of the time, one would end up with a "black" > series of images. > > So, I wrote a simple function using matplotlib to view image collections, > which works quite well, and I think it can be extended to display nD images > with multiple sliders. > > def ddd(images): > def _update_image(num): > num = int(num) > image = np.squeeze(images[num:num+1]) > img_ax.set_data(image) > fig.canvas.draw_idle() > > if images.ndim is not 3: > raise ValueError("Not a 3D image.") > > Z, _, _ = images.shape > > fig, ax = plt.subplots() > img_ax = ax.imshow(np.squeeze(images[0]), cmap="gray") > ax.axis("off") > > sliderax = plt.axes([0.19, 0.05, 0.65, 0.03], > facecolor="lightgoldenrodyellow") > img_slider = Slider(sliderax, "Z", 0, Z-1, > valfmt='%d', valinit=0) > img_slider.on_changed(_update_image) > plt.show() > > > This might be a bit redundant, but I would like your thoughts on whether > this might be useful for scikit-image. Some of the plugins of > CollectionViewer can be rewritten for this matplotlib based approach in a > much more readable fashion -- for instance, the line profile plugin. > > Best, > > -- > Kesavan Subburam > -- Kesavan -------------- next part -------------- An HTML attachment was scrubbed... URL: From fdalforno at gmail.com Fri May 26 02:41:38 2017 From: fdalforno at gmail.com (Fabio) Date: Fri, 26 May 2017 08:41:38 +0200 Subject: [scikit-image] Fwd: Extract a particular area in document In-Reply-To: References: Message-ID: Hi all, my name's Fabio Dal Forno. I'm a basic scikit user and i have many question too. I've a lot of scanned document like this And i want to extract a particular area (si no, yes or no in english) see image below ? After that i want to train a neural networ for detect the data compiled by people, y,x coordinate for detect the means of the area (materials damage ecc ecc) and a fixed dimension image for a neural network I started to work with the following step: 1) Homography for detect document orientation after that i transform the document for rectify that 2) Homography for detect si/no area and coordinate once the first step work wery well but the second doesn't detect anything. Am i wrong reasoning ? Thanks a lot and sorry for my beginner english :) ? -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: first.JPG Type: image/jpeg Size: 199433 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: testarea.png Type: image/png Size: 1986 bytes Desc: not available URL: From jni.soma at gmail.com Fri May 26 02:50:22 2017 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Fri, 26 May 2017 16:50:22 +1000 Subject: [scikit-image] Fwd: Extract a particular area in document In-Reply-To: References: Message-ID: Hi Fabio! Ach, you just gave me flashbacks to the time someone broke my car window when I was holidaying in Lido di Ostia. =P Cool work though! =) What do you mean by "using a homography" to detect the Si/No boxes? Could you provide maybe a sample image and working code? It's hard to tell what is going wrong without that context. I understand that there's privacy concerns but maybe you could fill in a blank form as test data? (Or your code to try to find the two si/no boxes that are not masked in the image below.) One thing I'll say though is that neural networks require lots and lots of ground truth data to train effectively, and is probably overkill for what you want to do. In your case, you can probably align the car images very accurately, and detecting marks outside of that should not be too hard. Good luck! Juan. On 26 May 2017, 4:42 PM +1000, Fabio , wrote: > Hi all, my name's Fabio Dal Forno. > > I'm a basic scikit user and i have many question too. > > > > I've a lot of scanned document like this > > > > > > > > And i want to extract a particular area (si no, yes or no in english) see image below > > > > > > > > After that i want to train a neural networ for detect the data compiled by people, y,x coordinate for detect the means of the area (materials damage ecc ecc) > > and a fixed dimension image for a neural network > > > > I started to work with the following step: > > > > 1) Homography for detect document orientation after that i transform the document for rectify that > > 2) Homography for detect si/no area and coordinate once > > > > the first step work wery well but the second doesn't detect anything. > > > > Am i wrong reasoning ? > > > > > > Thanks a lot and sorry for my beginner english :) > > > > > > > > > > > > _______________________________________________ > scikit-image mailing list > scikit-image at python.org > https://mail.python.org/mailman/listinfo/scikit-image -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: first.JPG Type: image/jpeg Size: 199433 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: testarea.png Type: image/png Size: 1986 bytes Desc: not available URL: From imagepy at sina.com Fri May 26 05:55:38 2017 From: imagepy at sina.com (imagepy at sina.com) Date: Fri, 26 May 2017 17:55:38 +0800 Subject: [scikit-image] =?gbk?b?u9i4tKO6IEZ3ZDogRXh0cmFjdCBhIHBhcnRpY3Vs?= =?gbk?q?ar_area_in_document?= Message-ID: <20170526095538.AEF5A380544@webmail.sinamail.sina.com.cn> Hi FWD: There are many methods to do this. as you said, you had do a transform to make sure the image in standard direction. if your image are in the standard scale, you can use a template match. but if has different scales, it will not work. but I think you can do a threshold, then binary fill, then the [no, si] will be a solid rectangle. you can do a region analysis http://scikit-image.org/docs/stable/api/skimage.measure.html#regionprops to make sure if it is your goal (by the area, perimeter and moments). I think it will be ok! you can also try the adboost, sift, and other local descriptor, and so on. but I think it is too fussy and waste to solve this problem. YXDragon ----- ???? ----- ????Fabio ????scikit-image at python.org ???[scikit-image] Fwd: Extract a particular area in document ???2017?05?26? 14?42? Hi all, my name's Fabio Dal Forno. I'm a basic scikit user and i have many question too. I've a lot of scanned document like this And i want to extract a particular area (si no, yes or no in english) see image below ? After that i want to train a neural networ for detect the data compiled by people, y,x coordinate for detect the means of the area (materials damage ecc ecc) and a fixed dimension image for a neural network I started to work with the following step: 1) Homography for detect document orientation after that i transform the document for rectify that 2) Homography for detect si/no area and coordinate once the first step work wery well but the second doesn't detect anything. Am i wrong reasoning ? Thanks a lot and sorry for my beginner english :) ? _______________________________________________ scikit-image mailing list scikit-image at python.org https://mail.python.org/mailman/listinfo/scikit-image -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: first.JPG Type: image/jpeg Size: 199433 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: testarea.png Type: image/png Size: 1986 bytes Desc: not available URL: From matthew.brett at gmail.com Fri May 26 17:37:07 2017 From: matthew.brett at gmail.com (Matthew Brett) Date: Fri, 26 May 2017 22:37:07 +0100 Subject: [scikit-image] Daily wheel builds Message-ID: Hi, I just set up daily wheel builds for scikit-image master. They run via travis-ci cron jobs, and have the dual role of testing that wheel building works, as well as testing on 32-bit Linux, and several macOS versions. The wheel builds run from the "daily" branch of the scikit-image-wheels repo: https://github.com/scikit-image/scikit-image-wheels/tree/daily See here for logs of the daily builds: https://travis-ci.org/scikit-image/scikit-image-wheels/branches The build exposed a few test failures on 32-bit - see: https://github.com/scikit-image/scikit-image/issues/2670 Cheers, Matthew From stefanv at berkeley.edu Sat May 27 06:36:21 2017 From: stefanv at berkeley.edu (Stefan van der Walt) Date: Sat, 27 May 2017 12:36:21 +0200 Subject: [scikit-image] Daily wheel builds In-Reply-To: References: Message-ID: <15c497a70a0.273e.acf34a9c767d7bb498a799333be0433e@fastmail.com> On May 26, 2017 23:38:20 Matthew Brett wrote: > I just set up daily wheel builds for scikit-image master. Thanks, Matthew! This is very helpful, especially the 32-bit builds. Best regards St?fan From interactpy at gmail.com Sat May 27 16:47:58 2017 From: interactpy at gmail.com (EV Petr) Date: Sat, 27 May 2017 23:47:58 +0300 Subject: [scikit-image] Whar are values returned by measure.marching_cubes Message-ID: Hello, I'm not familiar with scikit-image. I only want to use the function `measure.marching_cubes`, but I cannot figure out what really represent the values returned by it. `help(measure.marching_cubes)` says: *values : (V, ) array* *Gives a measure for the maximum value of the data in the local region near each vertex. This can be used by visualization tools to apply a colormap to the mesh.* What is data here (this term is too general)? I saw that values.shape[0] is the same as vertices.shape[0]. Hence each value is associated to a vertex. How is it assigned to a vertex? How are these values related to the volume or to the equation F(x,y,z)=0? (I want to extract a triangulation of an implicit surface having this equation). A second question is related to the coordinates of vertices. When I plot the trisurf defined by `vertices` and `faces` I notice that the x, y and z-range illustrated by tick values is different from the real values. More precisely: if my surface has zmin=-1 and zmax=2, on z-axis this range is [5,11]. Is there a transformation that maps the vertices coordinates, as they are returned by `measure.marching_cubes` to real coordinates on my surface? Thanks, Eve -------------- next part -------------- An HTML attachment was scrubbed... URL: