A robot-vision report may store each selected pixel as a row containing its row and column coordinates. That table is convenient to inspect, but placing it directly inside a NumPy array index does not tell NumPy to interpret each table row as one pixel address. The distinction can change both the selected data and the result's dimensions without raising an exception.
An original offline fixture demonstrates the problem with a four-row, five-column array. Its numbers are invented cell labels, not image intensities, distances, confidence scores, or measurements from a camera. The local execution used Python 3.14.7 and NumPy 2.5.2; no robot or vision system was connected.
Define two selected cells
Construct x = np.arange(20).reshape(4, 5). Row zero contains 0 through 4, row one contains 5 through 9, row two contains 10 through 14, and row three contains 15 through 19. In this construction, the value at row r and column c is 5*r + c.
Define mask = (x == 5) | (x == 13). Exactly two cells satisfy that condition: row 1, column 0, and row 2, column 3. Coordinates in this article are zero-based and written in row-column order. The mask's shape remains (4, 5), matching the array.
Calling coords = np.argwhere(mask) produces the table [[1, 0], [2, 3]], with shape (2, 2). The first dimension counts the selected cells. The second dimension contains one coordinate for each of the input's two axes. Neither dimension in that table is the image width.
The official argwhere reference describes this grouping by element and explicitly directs array-indexing use toward nonzero. The nonzero reference describes a tuple containing an index array for each input dimension. These are different arrangements of related coordinate information. [NumPy argwhere](https://numpy.org/doc/stable/reference/generated/numpy.argwhere.html), [NumPy nonzero](https://numpy.org/doc/stable/reference/generated/numpy.nonzero.html).
Observe the direct table index
Evaluate wrong = x[coords] in the fixture. It succeeds, but its shape is (2, 2, 5), and it contains twenty values. The intended selection contained two individual cells. Successful execution therefore does not establish that the coordinate table was interpreted as those two addresses.
The first index table row, [1, 0], causes the result's first block to contain the complete source rows 1 and 0. That block is [[5, 6, 7, 8, 9], [0, 1, 2, 3, 4]]. The second block contains complete rows 2 and 3, holding 10 through 19 in their original row order.
In this expression, coords is one integer index array applied to the first axis. Its individual numbers are used as row indices. The second source axis remains available as full five-element rows. The two-dimensional index-array shape is followed by that untouched source dimension, producing the observed (2, 2, 5) result.
Every number in coords happens to be a valid row index for this four-row array. This deliberate choice avoids an out-of-range error that could otherwise hide the wrong selection rule. An exception is not a necessary symptom of the mistake.
Supply one index array per axis
For the fixture, coords.T has rows [1, 2] and [0, 3]. Constructing tuple(coords.T) makes a two-item tuple: one integer array for the row axis and another for the column axis. Evaluating x[tuple(coords.T)] returns [5, 13], with shape (2,).
The coordinate positions are paired. The first row index 1 combines with the first column index 0; the second row index 2 combines with the second column index 3. The result follows those two pairs rather than selecting complete rows or every combination of the listed coordinates.
This is an explicit conversion for the two-dimensional coordinate table used here. The article does not propose sending every arbitrary array named coords through this expression without checking its shape, integer values, axis order, and relationship to the source array.
NumPy's indexing guide explains the distinction between a single integer array index and a tuple supplying indices across dimensions. The saved fixture retains the actual arrays and shapes so the explanation can be checked against its concrete result. [NumPy indexing guide](https://numpy.org/doc/stable/user/basics.indexing.html).
Keep the nonzero form when indexing is the goal
Calling axes = np.nonzero(mask) directly returns the row-index array [1, 2] and the column-index array [0, 3] inside a tuple. The local expression x[axes] returns [5, 13]. Indexing with the original Boolean mask, x[mask], returns those same values in this fixture.
If the report needs both readable coordinate records and selected values, it can retain the coordinate table for presentation while using the axis-grouped tuple or Boolean mask for the selection. The table's convenient display format does not need to become an implicit indexing contract.
Keep the same source array and mask together during that comparison. Coordinates computed from a transposed, cropped, resized, or different frame do not acquire the correct frame identity merely because their dimensions happen to fit. This fixture only checks the stated four-by-five array and its own mask.
Check empty and single-cell selections
An all-false mask produces an argwhere result with shape (0, 2). Direct table indexing then returns shape (0, 2, 5) in the local run. The explicit coordinate-tuple form returns shape (0,). Both contain no selected values, but their structural contracts differ.
A mask selecting only label 13 produces coords = [[2, 3]]. Direct table indexing returns shape (1, 2, 5), while the coordinate-tuple selection returns the single value [13]. Reducing the selection to one cell does not automatically make the table suitable as a pixel index.
The test also confirms that the original label array remains unchanged. These operations read selections; the fixture does not assign results back into an image or test an image-processing application. Its evidence concerns which values and dimensions the declared indexing expressions return.
Sources were checked November 18, 2026 in the official NumPy v2.5 documentation. The array, mask, coordinate pairs, and control cases are original local tests. The accompanying AI-generated concept illustration depicts this synthetic coordinate selection, not a camera image, defect inspection, or measured robot-vision performance.