The flow and yielding of granular materials involves various unpredictable phenomena like stability of rocks and avalanche formation on an incline, or shear localization in a granular material under load. The aim of the research is to analyze the internal structure and movement of a granular material and to develop a software (python,C, C++) for this purpose. The images are either three-dimensional arrays taken by X-ray Computed Tomography (X-Ray CT) or two-dimensional images taken by a fast camera. The goal is to determine the position and orientation of particles with complex (elongated, flattened or concave) shape. Analyzing the motion and rotation of non-spherical particles during flow provides us information about the interaction between neighboring grains, and global effects like shear localization, weakening of the material during yielding, velocity fluctuations during flow or clog formation in silos or narrow channels. This helps us in testing the predictive power of theoretical models or finding empirical relationships describing granular flow in specific geometries.